1

implement semaphore

This commit is contained in:
2022-07-11 15:00:05 +02:00
parent be6aeb2b11
commit 012f68838b
4 changed files with 39 additions and 1 deletions

View File

@ -50,6 +50,8 @@ static inline unsigned long CAS(unsigned long* ptr, unsigned long old, unsigned
* Beschreibung: Lock belegen. *
*****************************************************************************/
void SpinLock::acquire() {
// If lock == 0 the SpinLock can be aquired without waiting
// If lock == 1 the while loop blocks until aquired
while (CAS(ptr, 0, 1) != 0) {}
}