]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Now that the return value semantics of cv's for multithreaded processes
authorjhb <jhb@FreeBSD.org>
Thu, 19 Aug 2004 11:31:42 +0000 (11:31 +0000)
committerjhb <jhb@FreeBSD.org>
Thu, 19 Aug 2004 11:31:42 +0000 (11:31 +0000)
commit9e08178eb7f76d4c0238edff1e39930e0d6ee70e
tree0e4978383f95ccaee9fad964201d8694bc8eaf63
parent4b7b5c6f6a763532ffe2c98abd2a233bb1484224
Now that the return value semantics of cv's for multithreaded processes
have been unified with that of msleep(9), further refine the sleepq
interface and consolidate some duplicated code:
- Move the pre-sleep checks for theaded processes into a
  thread_sleep_check() function in kern_thread.c.
- Move all handling of TDF_SINTR to be internal to subr_sleepqueue.c.
  Specifically, if a thread is awakened by something other than a signal
  while checking for signals before going to sleep, clear TDF_SINTR in
  sleepq_catch_signals().  This removes a sched_lock lock/unlock combo in
  that edge case during an interruptible sleep.  Also, fix
  sleepq_check_signals() to properly handle the condition if TDF_SINTR is
  clear rather than requiring the callers of the sleepq API to notice
  this edge case and call a non-_sig variant of sleepq_wait().
- Clarify the flags arguments to sleepq_add(), sleepq_signal() and
  sleepq_broadcast() by creating an explicit submask for sleepq types.
  Also, add an explicit SLEEPQ_MSLEEP type rather than a magic number of
  0.  Also, add a SLEEPQ_INTERRUPTIBLE flag for use with sleepq_add() and
  move the setting of TDF_SINTR to sleepq_add() if this flag is set rather
  than sleepq_catch_signals().  Note that it is the caller's responsibility
  to ensure that sleepq_catch_signals() is called if and only if this flag
  is passed to the preceeding sleepq_add().  Note that this also removes a
  sched_lock lock/unlock pair from sleepq_catch_signals().  It also ensures
  that for an interruptible sleep, TDF_SINTR is always set when
  TD_ON_SLEEPQ() is true.
sys/kern/kern_condvar.c
sys/kern/kern_synch.c
sys/kern/kern_thread.c
sys/kern/subr_sleepqueue.c
sys/sys/proc.h
sys/sys/sleepqueue.h