diff options
author | Richard Braun <rbraun@sceen.net> | 2014-06-18 23:35:45 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2014-06-18 23:35:45 +0200 |
commit | c3c302a2041e05765d97b1c8d44735a56da0f1cd (patch) | |
tree | 86d79fba374c6a8e4638182124aac5fa260743d0 /kern/thread.h | |
parent | f6dd434b4b37ca7bcabed3d219bcdf7cd6fce815 (diff) |
kern/thread: support thread_sleep without interlock
The thread_sleep function takes a spin lock as a parameter. This lock is
used as an interlock allowing either the thread waking up or the thread
being awaken to run. But when threads don't need a lock to provide that
guarantee, the interlock is only overhead. This change makes thread_sleep
assume disabling preemption is used as a synchronization mechanism when
the interlock is NULL.
Diffstat (limited to 'kern/thread.h')
-rw-r--r-- | kern/thread.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kern/thread.h b/kern/thread.h index 01d59e5f..aa5dc4f7 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -273,6 +273,10 @@ void __noreturn thread_exit(void); * The interlock is used to synchronize the thread state with respect to * wakeups, i.e. a wakeup request sent by another thread will not be missed * if that thread is holding the interlock. + * As a special exception, threads that use preemption as a synchronization + * mechanism can ommit the interlock and pass a NULL pointer instead. + * In any case, the preemption nesting level must strictly be one when calling + * this function. * * This is a low level thread control primitive that should only be called by * higher thread synchronization functions. |