blob: 6dfdae4b7a014ad0753c44084ca46af120fc1c7d [file] [log] [blame]
swissChili52a03d82021-07-18 15:22:14 -07001#pragma once
2
3#include <kint.h>
4
5// Synchronization primitives
6
7/// Spinlock
swissChilie4229a22023-01-01 15:59:53 -05008typedef int spinlock_t;
swissChili52a03d82021-07-18 15:22:14 -07009
10void sl_acquire(spinlock_t *sl);
11void sl_release(spinlock_t *sl);
12spinlock_t sl_new();
13
14/// Semaphore
swissChilie4229a22023-01-01 15:59:53 -050015typedef int semaphore_t;
swissChili52a03d82021-07-18 15:22:14 -070016
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();