Common: Polish Fiber class, add comments, asserts and more tests.

This commit is contained in:
Fernando Sahmkow 2020-02-05 15:48:20 -04:00
parent 8d0e3c5422
commit be320a9e10
5 changed files with 147 additions and 25 deletions

View file

@ -43,4 +43,11 @@ void SpinLock::unlock() {
lck.clear(std::memory_order_release);
}
bool SpinLock::try_lock() {
if (lck.test_and_set(std::memory_order_acquire)) {
return false;
}
return true;
}
} // namespace Common