1
This commit is contained in:
parent
35fab7672b
commit
2465f88e78
@ -14,15 +14,15 @@ namespace a8
|
||||
|
||||
}
|
||||
|
||||
SpinLock::lock()
|
||||
void SpinLock::lock()
|
||||
{
|
||||
bool expect = false;
|
||||
while (!flag_.compare_exchange_weak(except, true)) {
|
||||
while (!flag_.compare_exchange_weak(expect, true)) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
SpinLock::unlock()
|
||||
void SpinLock::unlock()
|
||||
{
|
||||
flag_.store(false);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace a8
|
||||
|
||||
private:
|
||||
|
||||
std::atomic<bool> flags_;
|
||||
std::atomic<bool> flag_;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user