Skip to content

Commit

Permalink
Use sync.Mutex instead of sync/atomic for 32 bit systems (#388)
Browse files Browse the repository at this point in the history
Change CLRF -> LF
  • Loading branch information
thrasher- authored Nov 28, 2019
1 parent e20d204 commit d636882
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 41 deletions.
44 changes: 22 additions & 22 deletions contrib/bash_autocomplete
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#! /bin/bash
# bash programmable completion for gctcli
# copy to /etc/bash_completion.d/gctcli and source it or restart your shell

: ${PROG:=$(basename ${BASH_SOURCE})}

_gctcli() {
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ "$cur" == "-"* ]]; then
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
else
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
fi
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}

complete -o bashdefault -o default -o nospace -F _gctcli $PROG
#! /bin/bash
# bash programmable completion for gctcli
# copy to /etc/bash_completion.d/gctcli and source it or restart your shell

: ${PROG:=$(basename ${BASH_SOURCE})}

_gctcli() {
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ "$cur" == "-"* ]]; then
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
else
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
fi
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}

This comment has been minimized.

Copy link
@nitsuaaisblink

nitsuaaisblink May 4, 2021

#! /bin/bash

bash programmable completion for gctcli

copy to /etc/bash_completion.d/gctcli and source it or restart your shell

: ${PROG:=$(basename ${BASH_SOURCE})}

_gctcli() {
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ "$cur" == "-"* ]]; then
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
else
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
fi
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}

complete -o bashdefault -o default -o nospace -F _gctcli $PROG


complete -o bashdefault -o default -o nospace -F _gctcli $PROG

This comment has been minimized.

Copy link
@nitsuaaisblink

nitsuaaisblink May 4, 2021

#! /bin/bash

bash programmable completion for gctcli

copy to /etc/bash_completion.d/gctcli and source it or restart your shell

: ${PROG:=$(basename ${BASH_SOURCE})}

_gctcli() {
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ "$cur" == "-"* ]]; then
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
else
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
fi
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}

complete -o bashdefault -o default -o nospace -F _gctcli $PROG

unset PROG
26 changes: 13 additions & 13 deletions contrib/zsh_autocomplete
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# zsh programmable completion for gctcli
# source zsh_autocomplete
_gctcli() {
local -a opts
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
_describe 'values' opts
return
}
# zsh programmable completion for gctcli
# source zsh_autocomplete

_gctcli() {

local -a opts

This comment has been minimized.

Copy link
@nitsuaaisblink

nitsuaaisblink May 4, 2021

zsh programmable completion for gctcli

source zsh_autocomplete

_gctcli() {

local -a opts
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")

_describe 'values' opts

return
}

compdef _gctcli gctcli

opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")

_describe 'values' opts

return
}

This comment has been minimized.

Copy link
@nitsuaaisblink

nitsuaaisblink May 4, 2021

opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")

_describe 'values' opts

return
}

compdef _gctcli gctcli

compdef _gctcli gctcli
4 changes: 2 additions & 2 deletions exchanges/huobi/huobi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type CancelOpenOrdersBatch struct {
// DetailMerged stores the ticker detail merged data
type DetailMerged struct {
Detail
Version int `json:"version"`
Version int64 `json:"version"`

This comment has been minimized.

Copy link
@nitsuaaisblink

nitsuaaisblink May 4, 2021

opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")

_describe 'values' opts

return
}

compdef _gctcli gctcli

Ask []float64 `json:"ask"`
Bid []float64 `json:"bid"`
}
Expand Down Expand Up @@ -108,7 +108,7 @@ type Detail struct {
Close float64 `json:"close"`
High float64 `json:"high"`
Timestamp int64 `json:"timestamp"`
ID int `json:"id"`
ID int64 `json:"id"`
Count int `json:"count"`

This comment has been minimized.

Copy link
@nitsuaaisblink

nitsuaaisblink May 4, 2021

Ask []float64 json:"ask"
Bid []float64 json:"bid"
}
@@ -108,7 +108,7 @@ type Detail struct {
Close float64 json:"close"
High float64 json:"high"
Timestamp int64 json:"timestamp"
ID int64 json:"id"
Count int json:"count"
Low float64 json:"low"
Volume float64 json:"vol"

Low float64 `json:"low"`
Volume float64 `json:"vol"`
Expand Down
15 changes: 11 additions & 4 deletions exchanges/nonce/nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@ package nonce

import (
"strconv"
"sync/atomic"
"sync"
)

// Nonce struct holds the nonce value
type Nonce struct {
n int64
m sync.Mutex
}

// Inc increments the nonce value
func (n *Nonce) Inc() {
atomic.AddInt64(&n.n, 1)
n.m.Lock()
n.n++
n.m.Unlock()
}

// Get retrives the nonce value
func (n *Nonce) Get() Value {
return Value(atomic.LoadInt64(&n.n))
n.m.Lock()
defer n.m.Unlock()
return Value(n.n)
}

// GetInc increments and returns the value of the nonce
Expand All @@ -28,7 +33,9 @@ func (n *Nonce) GetInc() Value {

// Set sets the nonce value
func (n *Nonce) Set(val int64) {
atomic.StoreInt64(&n.n, val)
n.m.Lock()
n.n = val
n.m.Unlock()
}

// String returns a string version of the nonce
Expand Down

0 comments on commit d636882

Please sign in to comment.