summaryrefslogtreecommitdiff
path: root/viengoos/thread.h
diff options
context:
space:
mode:
authorneal <neal>2008-01-15 11:00:22 +0000
committerneal <neal>2008-01-15 11:00:22 +0000
commit9fbae31db65fbe7f4a36faa56cb6a08585fa4fa2 (patch)
treeb817709b20fee996bb9f4b7a95272bad2f92fccc /viengoos/thread.h
parent8596032ca1a6ca09c674e37092439d8f977b9041 (diff)
hurd/
2008-01-15 Neal H. Walfield <neal@gnu.org> * futex.h (futex_wait): New file. * Makefile.am (includehurd_HEADERS): Add futex.h. * headers.m4: Link $(BUILDIR)/include/hurd/futex.h to futex.h. * RPC: Add futex message id assignment. * folio.h (struct folio): Add field wait_queue. Remove field checksum (for now). viengoos/ 2008-01-15 Neal H. Walfield <neal@gnu.org> * object.h (struct thread): New forward. (object_wait_queue_head): New declaration. (object_wait_queue_tail): New declaration. (object_wait_queue_next): New declaration. (object_wait_queue_prev): New declaration. (object_wait_queue_enqueue): New declaration. (object_wait_queue_dequeue): New declaration. (object_wait_queue_for_each): New macro. * object.c (object_wait_queue): New function. (object_wait_queue_head): Likewise. (object_wait_queue_tail): Likewise. (object_wait_queue_next): Likewise. (object_wait_queue_prev): Likewise. (object_wait_queue_check): Likewise. (object_wait_queue_enqueue): Likewise. (object_wait_queue_dequeue): Likewise. * thread.h (struct wait_queue_node): New structure. (struct thread): Add fields wait_queue_head, wait_queue_tail, futex_block, futex_offset and wait_queue. * thread.c (thread_deinit): If THREAD is enqueue on a wait queue, dequeue it. * rm.h: Include <hurd/futex.h>. (rm_method_id_string): Handle the RM_futex case. * server.c: Include <hurd/futex.h>. (server_loop): Implement the rm_futex method. ruth/ 2008-01-15 Neal H. Walfield <neal@gnu.org> * ruth.c: Include <hurd/futex.h>. (main) Test futex implementation.
Diffstat (limited to 'viengoos/thread.h')
-rw-r--r--viengoos/thread.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/viengoos/thread.h b/viengoos/thread.h
index f99a0cc..b7ab288 100644
--- a/viengoos/thread.h
+++ b/viengoos/thread.h
@@ -35,8 +35,16 @@ enum
THREAD_SLOTS = 3,
};
+struct wait_queue_node
+{
+ struct cap next;
+ struct cap prev;
+};
+
struct thread
{
+ /* User accessible fields. */
+
/* Address space. */
struct cap aspace;
@@ -47,6 +55,8 @@ struct thread
/* Capability identifying a page to use to store exceptions. */
struct cap exception_page;
+ /* Non-user accessible fields. */
+
/* Allocated thread id. */
l4_thread_id_t tid;
@@ -57,9 +67,25 @@ struct thread
l4_word_t user_handle;
/* Whether the thread data structure has been initialized. */
- l4_word_t init : 1;
+ uint32_t init : 1;
/* Whether the thread has been commissioned (a tid allocated). */
- l4_word_t commissioned : 1;
+ uint32_t commissioned : 1;
+
+ /* Whether this thread is the head of the wait queue. If so,
+ WAIT_QUEUE.PREV designates the object. */
+ uint32_t wait_queue_head : 1;
+
+ /* Whether this thread is the tail of the wait queue. If so,
+ WAIT_QUEUE.NEXT designates the object. */
+ uint32_t wait_queue_tail : 1;
+
+ /* If waiting on a futex object. */
+ uint32_t futex_block : 1;
+ /* The offset of the futex object. */
+ uint32_t futex_offset : PAGESIZE_LOG2;
+
+ /* The object the thread is waiting on. */
+ struct wait_queue_node wait_queue;
};
/* The hardwired base of the UTCB (2.5GB). */