diff options
Diffstat (limited to 'libcr_ipc')
-rw-r--r-- | libcr_ipc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | libcr_ipc/_linkedlist.c | 62 | ||||
-rw-r--r-- | libcr_ipc/_linkedlist.h | 51 | ||||
-rw-r--r-- | libcr_ipc/chan.c | 16 | ||||
-rw-r--r-- | libcr_ipc/include/libcr_ipc/_linkedlist_pub.h | 26 | ||||
-rw-r--r-- | libcr_ipc/include/libcr_ipc/chan.h | 7 | ||||
-rw-r--r-- | libcr_ipc/include/libcr_ipc/mutex.h | 5 | ||||
-rw-r--r-- | libcr_ipc/include/libcr_ipc/rpc.h | 5 | ||||
-rw-r--r-- | libcr_ipc/include/libcr_ipc/rwmutex.h | 5 | ||||
-rw-r--r-- | libcr_ipc/include/libcr_ipc/sema.h | 5 | ||||
-rw-r--r-- | libcr_ipc/mutex.c | 10 | ||||
-rw-r--r-- | libcr_ipc/rpc.c | 18 | ||||
-rw-r--r-- | libcr_ipc/rwmutex.c | 26 | ||||
-rw-r--r-- | libcr_ipc/sema.c | 18 |
14 files changed, 50 insertions, 205 deletions
diff --git a/libcr_ipc/CMakeLists.txt b/libcr_ipc/CMakeLists.txt index bd72f54..60d3f2d 100644 --- a/libcr_ipc/CMakeLists.txt +++ b/libcr_ipc/CMakeLists.txt @@ -6,7 +6,6 @@ add_library(libcr_ipc INTERFACE) target_include_directories(libcr_ipc PUBLIC INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) target_sources(libcr_ipc INTERFACE - _linkedlist.c chan.c mutex.c rpc.c diff --git a/libcr_ipc/_linkedlist.c b/libcr_ipc/_linkedlist.c deleted file mode 100644 index b27dba8..0000000 --- a/libcr_ipc/_linkedlist.c +++ /dev/null @@ -1,62 +0,0 @@ -/* libcr_ipc/_linkedlist.c - Common low-level linked lists for use in libcr_ipc - * - * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -#include <stddef.h> /* for NULL */ - -#include "_linkedlist.h" - -/* singly linked list *********************************************************/ - -void cr_ipc_sll_push_to_rear(_cr_ipc_sll_root *root, cr_ipc_sll_node *node) { - assert(root); - node->rear = NULL; - if (root->rear) - root->rear->rear = node; - else - root->front = node; - root->rear = node; -} - -void cr_ipc_sll_pop_from_front(_cr_ipc_sll_root *root) { - assert(root); - assert(root->front); - root->front = root->front->rear; - if (!root->front) - root->rear = NULL; -} - -/* doubly linked list *********************************************************/ - -void cr_ipc_dll_push_to_rear(_cr_ipc_dll_root *root, cr_ipc_dll_node *node) { - assert(root); - assert(node); - node->front = root->rear; - node->rear = NULL; - if (root->rear) - root->rear->rear = node; - else - root->front = node; - root->rear = node; -} - -void cr_ipc_dll_remove(_cr_ipc_dll_root *root, cr_ipc_dll_node *node) { - assert(root); - assert(node); - if (node->front) - node->front->rear = node->rear; - else - root->front = node->rear; - if (node->rear) - node->rear->front = node->front; - else - root->rear = node->front; -} - -void cr_ipc_dll_pop_from_front(_cr_ipc_dll_root *root) { - assert(root); - assert(root->front); - cr_ipc_dll_remove(root, root->front); -} diff --git a/libcr_ipc/_linkedlist.h b/libcr_ipc/_linkedlist.h deleted file mode 100644 index ab6d89e..0000000 --- a/libcr_ipc/_linkedlist.h +++ /dev/null @@ -1,51 +0,0 @@ -/* libcr_ipc/_linkedlist.h - Common low-level linked lists for use in libcr_ipc - * - * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -#ifndef _LIBCR_IPC__LINKEDLIST_H_ -#define _LIBCR_IPC__LINKEDLIST_H_ - -#include <libmisc/assert.h> - -#include <libcr_ipc/_linkedlist_pub.h> - -/* singly linked list *********************************************************/ - -typedef struct _cr_ipc_sll_node { - struct _cr_ipc_sll_node *rear; -} cr_ipc_sll_node; - -#define cr_ipc_sll_node_cast(node_typ, node_ptr) \ - ({ \ - static_assert(_Generic(node_ptr, cr_ipc_sll_node *: 1, default: 0), \ - "typeof("#node_ptr") != cr_ipc_sll_node *"); \ - assert(node_ptr); \ - static_assert(offsetof(node_typ, cr_ipc_sll_node) == 0); \ - ((node_typ*)(node_ptr)); \ - }) - -void cr_ipc_sll_push_to_rear(_cr_ipc_sll_root *root, cr_ipc_sll_node *node); -void cr_ipc_sll_pop_from_front(_cr_ipc_sll_root *root); - -/* doubly linked list *********************************************************/ - -typedef struct _cr_ipc_dll_node { - struct _cr_ipc_dll_node *front, *rear; -} cr_ipc_dll_node; - -#define cr_ipc_dll_node_cast(node_typ, node_ptr) \ - ({ \ - static_assert(_Generic(node_ptr, cr_ipc_dll_node *: 1, default: 0), \ - "typeof("#node_ptr") != cr_ipc_dll_node *"); \ - assert(node_ptr); \ - static_assert(offsetof(node_typ, cr_ipc_dll_node) == 0); \ - ((node_typ*)(node_ptr)); \ - }) - -void cr_ipc_dll_push_to_rear(_cr_ipc_dll_root *root, cr_ipc_dll_node *node); -void cr_ipc_dll_remove(_cr_ipc_dll_root *root, cr_ipc_dll_node *node); -void cr_ipc_dll_pop_from_front(_cr_ipc_dll_root *root); - -#endif /* _LIBCR_IPC__LINKEDLIST_H_ */ diff --git a/libcr_ipc/chan.c b/libcr_ipc/chan.c index 12d2ec2..6ccfa44 100644 --- a/libcr_ipc/chan.c +++ b/libcr_ipc/chan.c @@ -13,12 +13,10 @@ #include <libcr_ipc/chan.h> -#include "_linkedlist.h" - /* base channels **************************************************************/ struct cr_chan_waiter { - cr_ipc_dll_node; + lm_dll_node; cid_t cid; void *val_ptr; void (*dequeue)(void *, size_t); @@ -28,7 +26,7 @@ struct cr_chan_waiter { void cr_chan_dequeue(void *_ch, size_t) { struct _cr_chan *ch = _ch; - cr_ipc_dll_pop_from_front(&ch->waiters); + lm_dll_pop_from_front(&ch->waiters); } void _cr_chan_xfer(enum _cr_chan_waiter_typ self_typ, struct _cr_chan *ch, void *val_ptr, size_t val_size) { @@ -37,7 +35,7 @@ void _cr_chan_xfer(enum _cr_chan_waiter_typ self_typ, struct _cr_chan *ch, void if (ch->waiters.front && ch->waiter_typ != self_typ) { /* non-blocking fast-path */ /* Copy. */ - struct cr_chan_waiter *front = cr_ipc_dll_node_cast(struct cr_chan_waiter, ch->waiters.front); + struct cr_chan_waiter *front = lm_dll_node_cast(struct cr_chan_waiter, ch->waiters.front); if (self_typ == _CR_CHAN_SENDER) memcpy(front->val_ptr, val_ptr, val_size); else @@ -53,7 +51,7 @@ void _cr_chan_xfer(enum _cr_chan_waiter_typ self_typ, struct _cr_chan *ch, void .dequeue = cr_chan_dequeue, .dequeue_arg1 = ch, }; - cr_ipc_dll_push_to_rear(&ch->waiters, &self); + lm_dll_push_to_rear(&ch->waiters, &self); ch->waiter_typ = self_typ; cr_pause_and_yield(); } @@ -95,8 +93,8 @@ static inline enum cr_select_class cr_select_getclass(struct cr_select_arg arg) void cr_select_dequeue(void *_waiters, size_t idx) { struct cr_select_waiters *waiters = _waiters; for (size_t i = 0; i < waiters->cnt; i++) - cr_ipc_dll_remove(&(waiters->args[i].ch->waiters), - &(waiters->nodes[i])); + lm_dll_remove(&(waiters->args[i].ch->waiters), + &(waiters->nodes[i])); waiters->cnt = idx; } @@ -162,7 +160,7 @@ size_t cr_select_v(size_t arg_cnt, struct cr_select_arg arg_vec[]) { .dequeue_arg1 = &waiters, .dequeue_arg2 = i, }; - cr_ipc_dll_push_to_rear(&arg_vec[i].ch->waiters, &waiters.nodes[i]); + lm_dll_push_to_rear(&arg_vec[i].ch->waiters, &waiters.nodes[i]); } cr_pause_and_yield(); return waiters.cnt; diff --git a/libcr_ipc/include/libcr_ipc/_linkedlist_pub.h b/libcr_ipc/include/libcr_ipc/_linkedlist_pub.h deleted file mode 100644 index 6719ba4..0000000 --- a/libcr_ipc/include/libcr_ipc/_linkedlist_pub.h +++ /dev/null @@ -1,26 +0,0 @@ -/* libcr_ipc/_linkedlist_pub.h - Common low-level linked lists for use in libcr_ipc - * - * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -#ifndef _LIBCR_IPC__LINKEDLIST_PUB_H_ -#define _LIBCR_IPC__LINKEDLIST_PUB_H_ - -/* singly linked list *********************************************************/ - -struct _cr_ipc_sll_node; - -typedef struct { - struct _cr_ipc_sll_node *front, *rear; -} _cr_ipc_sll_root; - -/* doubly linked list *********************************************************/ - -struct _cr_ipc_dll_node; - -typedef struct { - struct _cr_ipc_dll_node *front, *rear; -} _cr_ipc_dll_root; - -#endif /* _LIBCR_IPC__LINKEDLIST_PUB_H_ */ diff --git a/libcr_ipc/include/libcr_ipc/chan.h b/libcr_ipc/include/libcr_ipc/chan.h index ad311a0..80acdb8 100644 --- a/libcr_ipc/include/libcr_ipc/chan.h +++ b/libcr_ipc/include/libcr_ipc/chan.h @@ -10,9 +10,8 @@ #include <stdbool.h> /* for bool */ #include <stddef.h> /* for size_t */ -#include <libmisc/macro.h> /* LM_CAT2_() */ - -#include <libcr_ipc/_linkedlist_pub.h> +#include <libmisc/linkedlist.h> /* for lm_dll_root */ +#include <libmisc/macro.h> /* for LM_CAT2_() */ /* base channels **************************************************************/ @@ -113,7 +112,7 @@ enum _cr_chan_waiter_typ { struct _cr_chan { enum _cr_chan_waiter_typ waiter_typ; - _cr_ipc_dll_root waiters; + lm_dll_root waiters; }; void _cr_chan_xfer(enum _cr_chan_waiter_typ self_typ, struct _cr_chan *ch, void *val_ptr, size_t val_size); diff --git a/libcr_ipc/include/libcr_ipc/mutex.h b/libcr_ipc/include/libcr_ipc/mutex.h index ec40f5c..0f3c9c2 100644 --- a/libcr_ipc/include/libcr_ipc/mutex.h +++ b/libcr_ipc/include/libcr_ipc/mutex.h @@ -9,10 +9,9 @@ #include <stdbool.h> /* for bool */ +#include <libmisc/linkedlist.h> #include <libmisc/private.h> -#include <libcr_ipc/_linkedlist_pub.h> - /** * A cr_mutex_t is a fair mutex. * @@ -24,7 +23,7 @@ typedef struct { BEGIN_PRIVATE(LIBCR_IPC_MUTEX_H); bool locked; - _cr_ipc_sll_root waiters; + lm_sll_root waiters; END_PRIVATE(LIBCR_IPC_MUTEX_H); } cr_mutex_t; diff --git a/libcr_ipc/include/libcr_ipc/rpc.h b/libcr_ipc/include/libcr_ipc/rpc.h index 07ace95..f091685 100644 --- a/libcr_ipc/include/libcr_ipc/rpc.h +++ b/libcr_ipc/include/libcr_ipc/rpc.h @@ -9,10 +9,9 @@ #include <stdbool.h> /* for bool */ +#include <libmisc/linkedlist.h> /* for lm_sll_root */ #include <libmisc/macro.h> /* for LM_CAT2_() */ -#include <libcr_ipc/_linkedlist_pub.h> - /** * CR_RPC_DECLARE(NAME, REQ_T, RESP_T) declares the following types * and methods: @@ -146,7 +145,7 @@ enum _cr_rpc_waiter_typ { struct _cr_rpc { enum _cr_rpc_waiter_typ waiter_typ; - _cr_ipc_sll_root waiters; + lm_sll_root waiters; }; void _cr_rpc_send_req(struct _cr_rpc *ch, void *req_ptr, size_t req_size, void *resp_ptr); diff --git a/libcr_ipc/include/libcr_ipc/rwmutex.h b/libcr_ipc/include/libcr_ipc/rwmutex.h index 924acce..d48abe9 100644 --- a/libcr_ipc/include/libcr_ipc/rwmutex.h +++ b/libcr_ipc/include/libcr_ipc/rwmutex.h @@ -9,10 +9,9 @@ #include <stdbool.h> +#include <libmisc/linkedlist.h> #include <libmisc/private.h> -#include <libcr_ipc/_linkedlist_pub.h> - /** * A cr_rwmutex_t is a fair read/write mutex. * @@ -29,7 +28,7 @@ typedef struct { unsigned nreaders; bool locked; bool unpausing; - _cr_ipc_sll_root waiters; + lm_sll_root waiters; END_PRIVATE(LIBCR_IPC_RWMUTEX_H); } cr_rwmutex_t; diff --git a/libcr_ipc/include/libcr_ipc/sema.h b/libcr_ipc/include/libcr_ipc/sema.h index ae8d93d..cc387f4 100644 --- a/libcr_ipc/include/libcr_ipc/sema.h +++ b/libcr_ipc/include/libcr_ipc/sema.h @@ -9,10 +9,9 @@ #include <stdbool.h> +#include <libmisc/linkedlist.h> #include <libmisc/private.h> -#include <libcr_ipc/_linkedlist_pub.h> - /** * A cr_sema_t is a fair unbounded[1] counting semaphore. * @@ -22,7 +21,7 @@ typedef struct { BEGIN_PRIVATE(LIBCR_IPC_SEMA_H); unsigned int cnt; bool unpausing; - _cr_ipc_sll_root waiters; + lm_sll_root waiters; END_PRIVATE(LIBCR_IPC_SEMA_H); } cr_sema_t; diff --git a/libcr_ipc/mutex.c b/libcr_ipc/mutex.c index 28debba..b0ebe05 100644 --- a/libcr_ipc/mutex.c +++ b/libcr_ipc/mutex.c @@ -9,10 +9,8 @@ #define IMPLEMENTATION_FOR_LIBCR_IPC_MUTEX_H YES #include <libcr_ipc/mutex.h> -#include "_linkedlist.h" - struct cr_mutex_waiter { - cr_ipc_sll_node; + lm_sll_node; cid_t cid; }; @@ -26,7 +24,7 @@ void cr_mutex_lock(cr_mutex_t *mu) { struct cr_mutex_waiter self = { .cid = cr_getcid(), }; - cr_ipc_sll_push_to_rear(&mu->waiters, &self); + lm_sll_push_to_rear(&mu->waiters, &self); cr_pause_and_yield(); } assert(mu->locked); @@ -38,8 +36,8 @@ void cr_mutex_unlock(cr_mutex_t *mu) { assert(mu->locked); if (mu->waiters.front) { - cr_unpause(cr_ipc_sll_node_cast(struct cr_mutex_waiter, mu->waiters.front)->cid); - cr_ipc_sll_pop_from_front(&mu->waiters); + cr_unpause(lm_sll_node_cast(struct cr_mutex_waiter, mu->waiters.front)->cid); + lm_sll_pop_from_front(&mu->waiters); } else mu->locked = false; } diff --git a/libcr_ipc/rpc.c b/libcr_ipc/rpc.c index a648fde..6d9422f 100644 --- a/libcr_ipc/rpc.c +++ b/libcr_ipc/rpc.c @@ -10,17 +10,15 @@ #include <libcr_ipc/rpc.h> -#include "_linkedlist.h" - struct cr_rpc_requester { - cr_ipc_sll_node; + lm_sll_node; cid_t cid; void *req_ptr; /* where to read req from */ void *resp_ptr; /* where to write resp to */ }; struct cr_rpc_responder { - cr_ipc_sll_node; + lm_sll_node; /* before enqueued | after dequeued */ /* -------------------+-------------------- */ cid_t cid; /* responder cid | requester cid */ @@ -34,8 +32,8 @@ void _cr_rpc_send_req(struct _cr_rpc *ch, void *req_ptr, size_t req_size, void * if (ch->waiters.front && ch->waiter_typ != _CR_RPC_REQUESTER) { /* fast-path (still blocks) */ struct cr_rpc_responder *responder = - cr_ipc_sll_node_cast(struct cr_rpc_responder, ch->waiters.front); - cr_ipc_sll_pop_from_front(&ch->waiters); + lm_sll_node_cast(struct cr_rpc_responder, ch->waiters.front); + lm_sll_pop_from_front(&ch->waiters); /* Copy the req to the responder's stack. */ memcpy(responder->ptr, req_ptr, req_size); /* Notify the responder that we have done so. */ @@ -50,7 +48,7 @@ void _cr_rpc_send_req(struct _cr_rpc *ch, void *req_ptr, size_t req_size, void * .req_ptr = req_ptr, .resp_ptr = resp_ptr, }; - cr_ipc_sll_push_to_rear(&ch->waiters, &self); + lm_sll_push_to_rear(&ch->waiters, &self); /* Wait for a responder to both copy our req and sed * `*resp_ptr`. */ cr_pause_and_yield(); @@ -65,8 +63,8 @@ void _cr_rpc_recv_req(struct _cr_rpc *ch, void *req_ptr, size_t req_size, void * if (ch->waiters.front && ch->waiter_typ != _CR_RPC_RESPONDER) { /* non-blocking fast-path */ struct cr_rpc_requester *requester = - cr_ipc_sll_node_cast(struct cr_rpc_requester, ch->waiters.front); - cr_ipc_sll_pop_from_front(&ch->waiters); + lm_sll_node_cast(struct cr_rpc_requester, ch->waiters.front); + lm_sll_pop_from_front(&ch->waiters); memcpy(req_ptr, requester->req_ptr, req_size); *ret_requester = requester->cid; @@ -76,7 +74,7 @@ void _cr_rpc_recv_req(struct _cr_rpc *ch, void *req_ptr, size_t req_size, void * .cid = cr_getcid(), .ptr = req_ptr, }; - cr_ipc_sll_push_to_rear(&ch->waiters, &self); + lm_sll_push_to_rear(&ch->waiters, &self); ch->waiter_typ = _CR_RPC_RESPONDER; cr_pause_and_yield(); *ret_requester = self.cid; diff --git a/libcr_ipc/rwmutex.c b/libcr_ipc/rwmutex.c index 04016d6..506459a 100644 --- a/libcr_ipc/rwmutex.c +++ b/libcr_ipc/rwmutex.c @@ -9,10 +9,8 @@ #define IMPLEMENTATION_FOR_LIBCR_IPC_RWMUTEX_H YES #include <libcr_ipc/rwmutex.h> -#include "_linkedlist.h" - struct cr_rwmutex_waiter { - cr_ipc_sll_node; + lm_sll_node; bool is_reader; cid_t cid; }; @@ -25,13 +23,13 @@ void cr_rwmutex_lock(cr_rwmutex_t *mu) { .is_reader = false, .cid = cr_getcid(), }; - cr_ipc_sll_push_to_rear(&mu->waiters, &self); - if (mu->waiters.front != &self.cr_ipc_sll_node || mu->locked) + lm_sll_push_to_rear(&mu->waiters, &self); + if (mu->waiters.front != &self.lm_sll_node || mu->locked) cr_pause_and_yield(); - assert(mu->waiters.front == &self.cr_ipc_sll_node); + assert(mu->waiters.front == &self.lm_sll_node); /* We now hold the lock (and are mu->waiters.front). */ - cr_ipc_sll_pop_from_front(&mu->waiters); + lm_sll_pop_from_front(&mu->waiters); assert(mu->nreaders == 0); mu->locked = true; mu->unpausing = false; @@ -45,17 +43,17 @@ void cr_rwmutex_rlock(cr_rwmutex_t *mu) { .is_reader = true, .cid = cr_getcid(), }; - cr_ipc_sll_push_to_rear(&mu->waiters, &self); - if (mu->waiters.front != &self.cr_ipc_sll_node || (mu->locked && mu->nreaders == 0)) + lm_sll_push_to_rear(&mu->waiters, &self); + if (mu->waiters.front != &self.lm_sll_node || (mu->locked && mu->nreaders == 0)) cr_pause_and_yield(); - assert(mu->waiters.front == &self.cr_ipc_sll_node); + assert(mu->waiters.front == &self.lm_sll_node); /* We now hold the lock (and are mu->waiters.front). */ - cr_ipc_sll_pop_from_front(&mu->waiters); + lm_sll_pop_from_front(&mu->waiters); mu->nreaders++; mu->locked = true; struct cr_rwmutex_waiter *waiter = mu->waiters.front - ? cr_ipc_sll_node_cast(struct cr_rwmutex_waiter, mu->waiters.front) + ? lm_sll_node_cast(struct cr_rwmutex_waiter, mu->waiters.front) : NULL; if (waiter && waiter->is_reader) { assert(mu->unpausing); @@ -74,7 +72,7 @@ void cr_rwmutex_unlock(cr_rwmutex_t *mu) { assert(!mu->unpausing); if (mu->waiters.front) { struct cr_rwmutex_waiter *waiter = - cr_ipc_sll_node_cast(struct cr_rwmutex_waiter, mu->waiters.front); + lm_sll_node_cast(struct cr_rwmutex_waiter, mu->waiters.front); mu->unpausing = true; cr_unpause(waiter->cid); } else { @@ -92,7 +90,7 @@ void cr_rwmutex_runlock(cr_rwmutex_t *mu) { if (mu->nreaders == 0 && !mu->unpausing) { if (mu->waiters.front) { struct cr_rwmutex_waiter *waiter = - cr_ipc_sll_node_cast(struct cr_rwmutex_waiter, mu->waiters.front); + lm_sll_node_cast(struct cr_rwmutex_waiter, mu->waiters.front); assert(!waiter->is_reader); mu->unpausing = true; cr_unpause(waiter->cid); diff --git a/libcr_ipc/sema.c b/libcr_ipc/sema.c index 85add6c..cb984b6 100644 --- a/libcr_ipc/sema.c +++ b/libcr_ipc/sema.c @@ -9,10 +9,8 @@ #define IMPLEMENTATION_FOR_LIBCR_IPC_SEMA_H YES #include <libcr_ipc/sema.h> -#include "_linkedlist.h" - struct cr_sema_waiter { - cr_ipc_sll_node; + lm_sll_node; cid_t cid; }; @@ -24,7 +22,7 @@ void cr_sema_signal(cr_sema_t *sema) { sema->cnt++; if (sema->waiters.front && !sema->unpausing) { cr_unpause( - cr_ipc_sll_node_cast(struct cr_sema_waiter, sema->waiters.front)->cid); + lm_sll_node_cast(struct cr_sema_waiter, sema->waiters.front)->cid); sema->unpausing = true; } cr_restore_interrupts(saved); @@ -37,7 +35,7 @@ void cr_sema_signal_from_intrhandler(cr_sema_t *sema) { sema->cnt++; if (sema->waiters.front && !sema->unpausing) { cr_unpause_from_intrhandler( - cr_ipc_sll_node_cast(struct cr_sema_waiter, sema->waiters.front)->cid); + lm_sll_node_cast(struct cr_sema_waiter, sema->waiters.front)->cid); sema->unpausing = true; } } @@ -51,15 +49,15 @@ void cr_sema_wait(cr_sema_t *sema) { struct cr_sema_waiter self = { .cid = cr_getcid(), }; - cr_ipc_sll_push_to_rear(&sema->waiters, &self); - if (sema->waiters.front != &self.cr_ipc_sll_node || !sema->cnt) + lm_sll_push_to_rear(&sema->waiters, &self); + if (sema->waiters.front != &self.lm_sll_node || !sema->cnt) cr_pause_and_yield(); - assert(sema->waiters.front == &self.cr_ipc_sll_node && sema->cnt); - cr_ipc_sll_pop_from_front(&sema->waiters); + assert(sema->waiters.front == &self.lm_sll_node && sema->cnt); + lm_sll_pop_from_front(&sema->waiters); sema->cnt--; if (sema->cnt && sema->waiters.front) cr_unpause( - cr_ipc_sll_node_cast(struct cr_sema_waiter, sema->waiters.front)->cid); + lm_sll_node_cast(struct cr_sema_waiter, sema->waiters.front)->cid); else sema->unpausing = false; cr_restore_interrupts(saved); |