feat: changed all terrain modifiers to use scoped locks

This commit is contained in:
Sara Gerretsen 2026-04-16 23:13:12 +02:00
parent 9d48b68db0
commit d352808154
6 changed files with 209 additions and 218 deletions

View file

@ -0,0 +1,27 @@
#include "shared_mutex.h"
void SharedMutex::lock_shared() {
this->lock.lock();
this->shared_count++;
this->lock.unlock();
}
void SharedMutex::unlock_shared() {
this->lock.lock();
this->shared_count--;
this->lock.unlock();
}
void SharedMutex::lock_exclusive() {
while (true) {
this->lock.lock();
if (this->shared_count == 0) {
return;
}
this->lock.unlock();
}
}
void SharedMutex::unlock_exclusive() {
this->lock.unlock();
}