freebsd-src/share
Christos Margiolis 44e128fe9d sound: Implement asynchronous device detach
Hot-unplugging a sound device, such as a USB sound card, whilst being
consumed by an application, results in an infinite loop until either the
application closes the device's file descriptor, or the channel
automatically times out after hw.snd.timeout seconds. In the case of a
detach however, the timeout approach is still not ideal, since we want
all resources to be released immediatelly, without waiting for N seconds
until we can use the bus again.

The timeout mechanism works by calling chn_sleep() in chn_read() and
chn_write() (see pcm/channel.c) in order to send the thread to sleep,
using cv_timedwait_sig(). Since chn_sleep() sets the CHN_F_SLEEPING flag
while waiting for cv_timedwait_sig() to return, we can test this flag in
pcm_unregister() (called during detach) and wakeup the sleeping
thread(s) to immediately kill the channel(s) being consumed.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 months
PR:		194727
Reviewed by:	dev_submerge.ch, bapt, markj
Differential Revision:	https://reviews.freebsd.org/D43545
2024-04-11 20:06:50 +02:00
..
colldef
colldef_unicode
ctypedef
dict
doc Grammar fix in share/doc/IPv6/IMPLEMENTATION 2024-02-13 15:16:01 +08:00
dtrace
examples share/examples/sound: Fix spelling "controller" 2024-02-13 14:18:04 +08:00
i18n
keys
man sound: Implement asynchronous device detach 2024-04-11 20:06:50 +02:00
misc Add OpenBSD 7.5 to bsd-family-tree 2024-04-05 15:33:48 +02:00
mk config.mk: Add MK_VIMAGE knob 2024-04-09 13:05:56 -04:00
monetdef
monetdef_unicode
msgdef
msgdef_unicode
numericdef
numericdef_unicode
security
sendmail
skel dot.profile: handle symlinked $HOME 2024-02-13 13:24:22 -05:00
snmp
syscons
tabset
termcap
tests
timedef
vt
zoneinfo
Makefile
Makefile.inc