tsleep: Add a PNOLOCK flag
Add a PNOLOCK flag so that, in the race circumstance where wakeup races are externally mitigated, tsleep() can be called with a sleep time of 0 without triggering an an assertion. Reviewed by: jhb Sponsored by: Netflix
This commit is contained in:
parent
8482aa7748
commit
1b97a054f3
@ -148,7 +148,8 @@ _sleep(const void *ident, struct lock_object *lock, int priority,
|
||||
#endif
|
||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock,
|
||||
"Sleeping on \"%s\"", wmesg);
|
||||
KASSERT(sbt != 0 || mtx_owned(&Giant) || lock != NULL,
|
||||
KASSERT(sbt != 0 || mtx_owned(&Giant) || lock != NULL ||
|
||||
(priority & PNOLOCK) != 0,
|
||||
("sleeping without a lock"));
|
||||
KASSERT(ident != NULL, ("_sleep: NULL ident"));
|
||||
KASSERT(TD_IS_RUNNING(td), ("_sleep: curthread not running"));
|
||||
|
@ -246,7 +246,8 @@
|
||||
#define PRIMASK 0x0ff
|
||||
#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
|
||||
#define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */
|
||||
#define PRILASTFLAG 0x200 /* Last flag defined above */
|
||||
#define PNOLOCK 0x400 /* OR'd with pri to allow sleeping w/o a lock */
|
||||
#define PRILASTFLAG 0x400 /* Last flag defined above */
|
||||
|
||||
#define NZERO 0 /* default "nice" */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user