Home
last modified time | relevance | path

Searched refs:sema (Results 1 – 2 of 2) sorted by relevance

/DragonOS-0.1.3/kernel/src/libs/
Dsemaphore.c6 void semaphore_down(semaphore_t *sema) in semaphore_down() argument
8 if (atomic_read(&sema->counter) > 0) // 信号量大于0,资源充足 in semaphore_down()
9 atomic_dec(&sema->counter); in semaphore_down()
18 list_append(&sema->wait_queue.wait_list, &wait.wait_list); in semaphore_down()
26 void semaphore_up(semaphore_t *sema) in semaphore_up() argument
28 if (list_empty(&sema->wait_queue.wait_list)) // 没有进程在等待资源 in semaphore_up()
30 atomic_inc(&sema->counter); in semaphore_up()
35 …wait_queue_node_t *wq = container_of(list_next(&sema->wait_queue.wait_list), wait_queue_node_t, wa… in semaphore_up()
/DragonOS-0.1.3/kernel/src/common/
Dsemaphore.h34 static __always_inline void semaphore_init(semaphore_t *sema, ul count) in semaphore_init() argument
36 atomic_set(&sema->counter, count); in semaphore_init()
37 wait_queue_init(&sema->wait_queue, NULL); in semaphore_init()
45 void semaphore_down(semaphore_t *sema);
47 void semaphore_up(semaphore_t *sema);