From a29cab0986973a39e3437e8cb287de408bd67263 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Wed, 17 Dec 2008 15:20:52 +0100 Subject: Change the rmutex implementation to use hurd tids, not l4 tids. 2008-12-17 Neal H. Walfield * rmutex.h (__need_vg_thread_id_t): Don't include . Define __need_vg_thread_id_t and include . (struct ss_rmutex): Change owner to a vg_thread_id_t. (SS_RMUTEX_INIT): Use vg_niltid instead of vg_niltid. (ss_rmutex_lock): Use hurd_myself instead of l4_myself. Use vg_niltid instead of l4_nilthread. (ss_rmutex_unlock): Likewise. (ss_rmutex_trylock): Likewise. --- hurd/ChangeLog | 11 +++++++++++ hurd/rmutex.h | 30 ++++++++++++++++-------------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/hurd/ChangeLog b/hurd/ChangeLog index 481ace9..e9ba5ba 100644 --- a/hurd/ChangeLog +++ b/hurd/ChangeLog @@ -1,3 +1,14 @@ +2008-12-17 Neal H. Walfield + + * rmutex.h (__need_vg_thread_id_t): Don't include . + Define __need_vg_thread_id_t and include . + (struct ss_rmutex): Change owner to a vg_thread_id_t. + (SS_RMUTEX_INIT): Use vg_niltid instead of vg_niltid. + (ss_rmutex_lock): Use hurd_myself instead of l4_myself. Use + vg_niltid instead of l4_nilthread. + (ss_rmutex_unlock): Likewise. + (ss_rmutex_trylock): Likewise. + 2008-12-17 Neal H. Walfield * exceptions.h: Don't include or . diff --git a/hurd/rmutex.h b/hurd/rmutex.h index ddba589..44e0644 100644 --- a/hurd/rmutex.h +++ b/hurd/rmutex.h @@ -24,17 +24,19 @@ /* For ss_mutex_t. */ #define __need_ss_mutex_t #include -/* For l4_thread_id_t. */ -#include +#define __need_vg_thread_id_t +#include struct ss_rmutex { ss_mutex_t lock; int count; - l4_thread_id_t owner; + vg_thread_id_t owner; }; typedef struct ss_rmutex ss_rmutex_t; +#define SS_RMUTEX_INIT { 0, 0, vg_niltid } + #endif /* !__hurd_rmutex_have_type */ /* If __need_ss_rmutex_t is defined, then we only export the type @@ -46,7 +48,7 @@ typedef struct ss_rmutex ss_rmutex_t; #ifndef _HURD_RMUTEX_H #define _HURD_RMUTEX_H -#define SS_RMUTEX_INIT { 0, 0, l4_nilthread } +#include static inline void ss_rmutex_lock (const char *caller, int line, ss_rmutex_t *lockp) @@ -55,7 +57,7 @@ ss_rmutex_lock (const char *caller, int line, ss_rmutex_t *lockp) { ss_mutex_lock (&lockp->lock); - if (lockp->owner == l4_myself ()) + if (lockp->owner == hurd_myself ()) { assert (lockp->count != 0); @@ -71,14 +73,14 @@ ss_rmutex_lock (const char *caller, int line, ss_rmutex_t *lockp) return; } - if (lockp->owner == l4_nilthread) + if (lockp->owner == vg_niltid) { assert (lockp->count == 0); ss_mutex_trace_add (SS_RMUTEX_LOCK, caller, line, lockp); lockp->count = 1; - lockp->owner = l4_myself (); + lockp->owner = hurd_myself (); ss_mutex_unlock (&lockp->lock); return; } @@ -111,11 +113,11 @@ ss_rmutex_unlock (const char *caller, int line, ss_rmutex_t *lockp) { ss_mutex_lock (&lockp->lock); - if (lockp->owner != l4_myself ()) + if (lockp->owner != hurd_myself ()) ss_lock_trace_dump (lockp); - assertx (lockp->owner == l4_myself (), + assertx (lockp->owner == hurd_myself (), "%x != %x (count: %d, caller: %s:%d)", - lockp->owner, l4_myself (), lockp->count, caller, line); + lockp->owner, hurd_myself (), lockp->count, caller, line); assert (lockp->count != 0); int waiters = lockp->count < 0; @@ -126,7 +128,7 @@ ss_rmutex_unlock (const char *caller, int line, ss_rmutex_t *lockp) bool released = lockp->count == 0; if (released) - lockp->owner = l4_nilthread; + lockp->owner = vg_niltid; if (lockp->count == 0) ss_mutex_trace_add (SS_RMUTEX_UNLOCK, caller, line, lockp); @@ -160,7 +162,7 @@ ss_rmutex_trylock (const char *caller, int line, ss_rmutex_t *lockp) return false; } - if (lockp->owner == l4_myself ()) + if (lockp->owner == hurd_myself ()) { assert (lockp->count != 0); @@ -176,13 +178,13 @@ ss_rmutex_trylock (const char *caller, int line, ss_rmutex_t *lockp) return true; } - if (lockp->owner == l4_nilthread) + if (lockp->owner == vg_niltid) { ss_mutex_trace_add (SS_RMUTEX_TRYLOCK, caller, line, lockp); assert (lockp->count == 0); lockp->count = 1; - lockp->owner = l4_myself (); + lockp->owner = hurd_myself (); ss_mutex_unlock (&lockp->lock); return true; } -- cgit v1.2.3