-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1752 from c9s/c9s/bitget/improvements
IMPROVE: [biget] several improvements
- Loading branch information
Showing
10 changed files
with
326 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package fixedpoint | ||
|
||
import "sync" | ||
|
||
type MutexValue struct { | ||
value Value | ||
mu sync.Mutex | ||
} | ||
|
||
func (f *MutexValue) Add(v Value) Value { | ||
f.mu.Lock() | ||
f.value = f.value.Add(v) | ||
ret := f.value | ||
f.mu.Unlock() | ||
return ret | ||
} | ||
|
||
func (f *MutexValue) Sub(v Value) Value { | ||
f.mu.Lock() | ||
f.value = f.value.Sub(v) | ||
ret := f.value | ||
f.mu.Unlock() | ||
return ret | ||
} | ||
|
||
func (f *MutexValue) Set(v Value) { | ||
f.mu.Lock() | ||
f.value = v | ||
f.mu.Unlock() | ||
} | ||
|
||
func (f *MutexValue) Get() Value { | ||
f.mu.Lock() | ||
v := f.value | ||
f.mu.Unlock() | ||
return v | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.