Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (14 sloc) 322 Bytes
bool lockWasTaken = false;
var temp = thisLock;
try {
Monitor.Enter(temp, ref lockWasTaken);
if (amount > balance) {
throw new Exception("Insufficient funds");
}
balance -= amount;
} finally {
if (lockWasTaken) {
Monitor.Exit(temp);
}
}
//https://pt.stackoverflow.com/q/28690/101
You can’t perform that action at this time.