summaryrefslogtreecommitdiff
path: root/libcr_ipc/mutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcr_ipc/mutex.c')
-rw-r--r--libcr_ipc/mutex.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libcr_ipc/mutex.c b/libcr_ipc/mutex.c
index 4a87a58..1b4e626 100644
--- a/libcr_ipc/mutex.c
+++ b/libcr_ipc/mutex.c
@@ -11,9 +11,9 @@
#include <libcr_ipc/mutex.h>
struct cr_mutex_waiter {
- lm_sll_node;
cid_t cid;
};
+SLIST_DECLARE_NODE(_cr_mutex_waiter_list, struct cr_mutex_waiter);
void cr_mutex_lock(cr_mutex_t *mu) {
assert(mu);
@@ -22,10 +22,10 @@ void cr_mutex_lock(cr_mutex_t *mu) {
if (!mu->locked) /* non-blocking fast-path */
mu->locked = true;
else { /* blocking slow-path */
- struct cr_mutex_waiter self = {
+ struct _cr_mutex_waiter_list_node self = { .val = {
.cid = cr_getcid(),
- };
- lm_sll_push_to_rear(&mu->waiters, &self);
+ }};
+ slist_push_to_rear(&mu->waiters, &self);
cr_pause_and_yield();
}
assert(mu->locked);
@@ -37,8 +37,8 @@ void cr_mutex_unlock(cr_mutex_t *mu) {
assert(mu->locked);
if (mu->waiters.front) {
- cr_unpause(lm_sll_node_cast(struct cr_mutex_waiter, mu->waiters.front)->cid);
- lm_sll_pop_from_front(&mu->waiters);
+ cr_unpause(mu->waiters.front->val.cid);
+ slist_pop_from_front(&mu->waiters);
} else
mu->locked = false;
}