summaryrefslogtreecommitdiff
path: root/kern/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'kern/thread.h')
-rw-r--r--kern/thread.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/kern/thread.h b/kern/thread.h
index e570cd29..01d59e5f 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -154,6 +154,7 @@ struct thread {
/* Thread-local members */
unsigned short preempt;
unsigned short pinned;
+ unsigned short llsync_read;
/* Common scheduling properties */
unsigned char sched_policy;
@@ -448,6 +449,40 @@ thread_preempt_disable(void)
}
/*
+ * Lockless synchronization read-side critical section nesting counter
+ * control functions.
+ */
+
+static inline int
+thread_llsync_in_read_cs(void)
+{
+ struct thread *thread;
+
+ thread = thread_self();
+ return (thread->llsync_read != 0);
+}
+
+static inline void
+thread_llsync_read_inc(void)
+{
+ struct thread *thread;
+
+ thread = thread_self();
+ thread->llsync_read++;
+ assert(thread->llsync_read != 0);
+}
+
+static inline void
+thread_llsync_read_dec(void)
+{
+ struct thread *thread;
+
+ thread = thread_self();
+ assert(thread->llsync_read != 0);
+ thread->llsync_read--;
+}
+
+/*
* Type for thread-specific data destructor.
*/
typedef void (*thread_dtor_fn_t)(void *);