blob: 3fbe209fec051ace3157998b70e84b4ff8082151 [file] [log] [blame]
swissChili52a03d82021-07-18 15:22:14 -07001#pragma once
2
3#include <kint.h>
4
5// Synchronization primitives
6
7/// Spinlock
8typedef volatile int spinlock_t;
9
10void sl_acquire(spinlock_t *sl);
11void sl_release(spinlock_t *sl);
12spinlock_t sl_new();
13
14/// Semaphore
15typedef volatile int semaphore_t;
16
17void sm_wait(semaphore_t sm);
18void sm_signal(semaphore_t sm);
19semaphore_t sm_new();
20
21/// Initialize synchronization primitives, only call this once after the
22/// scheduler has been initialized.
23void init_sync();