|
|
|
|
|
by chacham15
1593 days ago
|
|
Im pretty sure the same construct can be implemented without the compare: int lock = 0;
void AcquireLock(int *lock){
while (ATOMIC_SWAP(lock, 1)){
sleep(10); //or futex or w/e
}
}
void ReleaseLock(int *lock){
ATOMIC_SWAP(lock, 0);
}
|
|