SayoriOS  0.3.3
sync.c
См. документацию.
1 
9 #include "sys/sync.h"
10 
19 bool mutex_get(mutex_t* mutex, bool wait){
20  bool old_value = true;
21 
22  do {
23  __asm__ volatile ("xchg (,%1,), %0":"=a"(old_value):"b"(mutex), "a"(old_value));
24  } while (old_value && wait);
25 
26  return !old_value;
27 }
28 
36 void mutex_release(mutex_t* mutex){
37  *mutex = false;
38 }
bool mutex_get(mutex_t *mutex, bool wait)
Получить мьютекс
Definition: sync.c:19
void mutex_release(mutex_t *mutex)
Получить ближайщий свободный блок
Definition: sync.c:36