diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-12 13:29:32 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-12 23:29:30 +0200 |
commit | 5879781c77ac5ed903b3712aef546848681b449d (patch) | |
tree | d2f7c97e251d8d20cddd00df03b40443f8aacc79 /kern | |
parent | 1cb9726ece963ec4afa0577400b33d929eb47c7d (diff) | |
download | gnumach-5879781c77ac5ed903b3712aef546848681b449d.tar.gz gnumach-5879781c77ac5ed903b3712aef546848681b449d.tar.bz2 gnumach-5879781c77ac5ed903b3712aef546848681b449d.zip |
kern: Check that locking thread is done at spl7
Diffstat (limited to 'kern')
-rw-r--r-- | kern/thread.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/kern/thread.h b/kern/thread.h index 3485f6af..8547464d 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -392,8 +392,19 @@ extern void thread_unfreeze( #define thread_pcb(th) ((th)->pcb) /* Shall be taken at splsched only */ -#define thread_lock(th) simple_lock(&(th)->lock) -#define thread_unlock(th) simple_unlock(&(th)->lock) +#ifdef MACH_LDEBUG +#define thread_lock(th) do { \ + assert(splsched() == SPL7); \ + simple_lock_nocheck(&(th)->lock); \ +} while (0) +#define thread_unlock(th) do { \ + assert(splsched() == SPL7); \ + simple_unlock_nocheck(&(th)->lock); \ +} while (0) +#else +#define thread_lock(th) simple_lock_nocheck(&(th)->lock) +#define thread_unlock(th) simple_unlock_nocheck(&(th)->lock) +#endif #define thread_should_halt(thread) \ ((thread)->ast & (AST_HALT|AST_TERMINATE)) |