summaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-12-17 15:20:52 +0100
committerNeal H. Walfield <neal@gnu.org>2008-12-17 15:20:52 +0100
commita29cab0986973a39e3437e8cb287de408bd67263 (patch)
treee7dab56829fa7a35b973c6f883bdc281c02fce39 /hurd
parent4de91cdeafc5566289af7b0024c292207bc1eef9 (diff)
Change the rmutex implementation to use hurd tids, not l4 tids.
2008-12-17 Neal H. Walfield <neal@gnu.org> * rmutex.h (__need_vg_thread_id_t): Don't include <l4/thread.h>. Define __need_vg_thread_id_t and include <viengoos/thread.h>. (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.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/ChangeLog11
-rw-r--r--hurd/rmutex.h30
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,5 +1,16 @@
2008-12-17 Neal H. Walfield <neal@gnu.org>
+ * rmutex.h (__need_vg_thread_id_t): Don't include <l4/thread.h>.
+ Define __need_vg_thread_id_t and include <viengoos/thread.h>.
+ (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 <neal@gnu.org>
+
* exceptions.h: Don't include <viengoos/cap.h> or <l4/space.h>.
Include <viengoos/addr.h>.
(ACTIVATION_fault, activation_method_id_string)
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 <hurd/mutex.h>
-/* For l4_thread_id_t. */
-#include <l4/thread.h>
+#define __need_vg_thread_id_t
+#include <viengoos/thread.h>
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 <hurd/thread.h>
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;
}