Last active
August 29, 2015 13:57
-
-
Save amix/9517995 to your computer and use it in GitHub Desktop.
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
type Account struct { | |
balance float64 | |
... | |
sync.Mutex | |
} | |
func (a *Account) Deposit(amount float64) { | |
a.Lock() | |
defer a.Unlock() | |
a.balance += amount | |
} | |
... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment