freebsd-dev/sys/dev/sound/pcm
Alfred Perlstein 85f190e4d1 Fixes to make select/poll mpsafe.
Problem:
  selwakeup required calling pfind which would cause lock order
  reversals with the allproc_lock and the per-process filedesc lock.
Solution:
  Instead of recording the pid of the select()'ing process into the
  selinfo structure, actually record a pointer to the thread.  To
  avoid dereferencing a bad address all the selinfo structures that
  are in use by a thread are kept in a list hung off the thread
  (protected by sellock).  When a selwakeup occurs the selinfo is
  removed from that threads list, it is also removed on the way out
  of select or poll where the thread will traverse its list removing
  all the selinfos from its own list.

Problem:
  Previously the PROC_LOCK was used to provide the mutual exclusion
  needed to ensure proper locking, this couldn't work because there
  was a single condvar used for select and poll and condvars can
  only be used with a single mutex.
Solution:
  Introduce a global mutex 'sellock' which is used to provide mutual
  exclusion when recording events to wait on as well as performing
  notification when an event occurs.

Interesting note:
  schedlock is required to manipulate the per-thread TDF_SELECT
  flag, however if given its own field it would not need schedlock,
  also because TDF_SELECT is only manipulated under sellock one
  doesn't actually use schedlock for syncronization, only to protect
  against corruption.

Proc locks are no longer used in select/poll.

Portions contributed by: davidc
2002-03-14 01:32:30 +00:00
..
ac97_if.m MFS: add '# KOBJ' as the first line of each .m file to reduce diffs from 2001-03-05 16:42:06 +00:00
ac97.c Get rid of irritating (bogus) message: 2001-12-10 20:27:18 +00:00
ac97.h add a method for retrieving codec capabilities 2001-09-18 14:34:59 +00:00
buffer.c * improve error handling 2002-01-26 22:13:24 +00:00
buffer.h * improve error handling 2002-01-26 22:13:24 +00:00
channel_if.m beginnings of virtual playback channel support 2001-05-27 17:22:00 +00:00
channel.c Fixes to make select/poll mpsafe. 2002-03-14 01:32:30 +00:00
channel.h Fix code that had rotted behind debugging macros. 2002-01-25 04:14:12 +00:00
dsp.c Fix code that had rotted behind debugging macros. 2002-01-25 04:14:12 +00:00
dsp.h add a method for recording of specific channels for devices with more than 2001-09-05 16:28:41 +00:00
fake.c many changes: 2001-08-23 11:30:52 +00:00
feeder_fmt.c many changes: 2001-08-23 11:30:52 +00:00
feeder_if.m add a new method for retrieving feeder parameters 2001-05-27 14:49:14 +00:00
feeder_rate.c many changes: 2001-08-23 11:30:52 +00:00
feeder.c * improve error handling 2002-01-26 22:13:24 +00:00
feeder.h * improve error handling 2002-01-26 22:13:24 +00:00
mixer_if.m mega-commit. 2001-03-24 23:10:29 +00:00
mixer.c KSE Milestone 2 2001-09-12 08:38:13 +00:00
mixer.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
sndstat.c - Correctly increment the channel refcount in dsp_open() such that it is 2001-09-14 20:26:03 +00:00
sound.c * improve error handling 2002-01-26 22:13:24 +00:00
sound.h * improve error handling 2002-01-26 22:13:24 +00:00
vchan.c make mmapped vchans work 2001-12-23 13:10:29 +00:00
vchan.h many changes: 2001-08-23 11:30:52 +00:00