summaryrefslogtreecommitdiff
path: root/ipc/ipc_thread.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-08-24 22:34:03 +0200
committerRichard Braun <rbraun@sceen.net>2012-08-24 22:34:03 +0200
commitf5f6f62357b90e1ce1eb24f2929314b0d84078d0 (patch)
tree731aefb2e49b1f312fc6f823c987489ac181c8e1 /ipc/ipc_thread.h
parentd59b5731eaa93348485e2ae77e9b5d90fb1da36b (diff)
Store threads waiting on a message queue in LIFO order
* ipc/ipc_thread.h (ipc_thread_enqueue_macro): Insert thread at the head of the list instead of the tail.
Diffstat (limited to 'ipc/ipc_thread.h')
-rw-r--r--ipc/ipc_thread.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/ipc/ipc_thread.h b/ipc/ipc_thread.h
index e8bfe4a..fbeea46 100644
--- a/ipc/ipc_thread.h
+++ b/ipc/ipc_thread.h
@@ -46,6 +46,11 @@ typedef thread_t ipc_thread_t;
#define ith_lock(thread) simple_lock(&(thread)->ith_lock_data)
#define ith_unlock(thread) simple_unlock(&(thread)->ith_lock_data)
+/*
+ * Note that this isn't a queue, but rather a stack. This causes
+ * threads that were recently running to be reused earlier, which
+ * helps improve locality of reference.
+ */
typedef struct ipc_thread_queue {
ipc_thread_t ithq_base;
} *ipc_thread_queue_t;
@@ -103,6 +108,7 @@ MACRO_BEGIN \
(thread)->ith_prev = _last; \
_first->ith_prev = (thread); \
_last->ith_next = (thread); \
+ (queue)->ithq_base = (thread); \
} \
MACRO_END