summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_dsp.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2014-03-17 04:41:35 +0000
committerChristopher Faylor <me@cgf.cx>2014-03-17 04:41:35 +0000
commit4f0b5a097da2464a8d5120ccc64bf9cf24ddd890 (patch)
treefb20ca6ab06b28a3f7197d63158bb91efcaaf43f /winsup/cygwin/fhandler_dsp.cc
parent600afd99abacfd836b41930c6bc5e014bc5d94e3 (diff)
downloadcygnal-4f0b5a097da2464a8d5120ccc64bf9cf24ddd890.tar.gz
cygnal-4f0b5a097da2464a8d5120ccc64bf9cf24ddd890.tar.bz2
cygnal-4f0b5a097da2464a8d5120ccc64bf9cf24ddd890.zip
* sigproc.h (no_thread_exit_protect): New class.
* sigproc.cc (thread_exit): Use no_thread_exit_protect to determine if we need to coordinate ThreadExit/ExitProcess. * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Use no_thread_exit_protect to kludge around waiting for waveOutClose as it waits for a thread that never exits. (fhandler_dev_dsp::Audio_in::stop): Ditto for waveInClose. * fhandler.h (fhandler_dev_dsp::base): New method. (fhandler_dev_dsp::_read): Ditto. (fhandler_dev_dsp::_write): Ditto. (fhandler_dev_dsp::_ioctl): Ditto. (fhandler_dev_dsp::_fixup_after_fork): Ditto. (fhandler_dev_dsp::_fixup_after_exec): Ditto. * fhandler_dsp.cc (fhandler_dev_dsp::read): Call real function via base() pointer. (fhandler_dev_dsp::write): Ditto. (fhandler_dev_dsp::ioctl): Ditto. (fhandler_dev_dsp::fixup_after_fork): Ditto. (fhandler_dev_dsp::fixup_after_exec): Ditto. (fhandler_dev_dsp::_read): Rename by adding an leading underscore. (fhandler_dev_dsp::_write): Ditto. (fhandler_dev_dsp::_ioctl): Ditto. (fhandler_dev_dsp::_fixup_after_fork): Ditto. (fhandler_dev_dsp::_fixup_after_exec): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler_dsp.cc')
-rw-r--r--winsup/cygwin/fhandler_dsp.cc43
1 files changed, 38 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc
index 80b014219..04b13057a 100644
--- a/winsup/cygwin/fhandler_dsp.cc
+++ b/winsup/cygwin/fhandler_dsp.cc
@@ -435,6 +435,7 @@ fhandler_dev_dsp::Audio_out::stop (bool immediately)
debug_printf ("%u = waveOutUnprepareHeader(%p)", rc, pHdr);
}
+ no_thread_exit_protect for_now (true);
rc = waveOutClose (dev_);
debug_printf ("%u = waveOutClose()", rc);
@@ -810,6 +811,7 @@ fhandler_dev_dsp::Audio_in::stop ()
debug_printf ("%u = waveInUnprepareHeader(%p)", rc, pHdr);
}
+ no_thread_exit_protect for_now (true);
rc = waveInClose (dev_);
debug_printf ("%u = waveInClose()", rc);
@@ -1003,6 +1005,37 @@ fhandler_dev_dsp::fhandler_dev_dsp ():
dev ().parse (FH_OSS_DSP);
}
+ssize_t __stdcall
+fhandler_dev_dsp::write (const void *ptr, size_t len)
+{
+ return base ()->_write (ptr, len);
+}
+
+void __reg3
+fhandler_dev_dsp::read (void *ptr, size_t& len)
+{
+ return base ()->_read (ptr, len);
+}
+
+int
+fhandler_dev_dsp::ioctl (unsigned int cmd, void *)
+{
+ return base ()->_ioctl (cmd, NULL);
+}
+
+void
+fhandler_dev_dsp::fixup_after_fork (HANDLE parent)
+{
+ base ()->fixup_after_fork (parent);
+}
+
+void
+fhandler_dev_dsp::fixup_after_exec ()
+{
+ base ()->fixup_after_exec ();
+}
+
+
int
fhandler_dev_dsp::open (int flags, mode_t mode)
{
@@ -1046,7 +1079,7 @@ fhandler_dev_dsp::open (int flags, mode_t mode)
#define IS_READ() ((get_flags() & O_ACCMODE) != O_WRONLY)
ssize_t __stdcall
-fhandler_dev_dsp::write (const void *ptr, size_t len)
+fhandler_dev_dsp::_write (const void *ptr, size_t len)
{
debug_printf ("ptr=%p len=%ld", ptr, len);
int len_s = len;
@@ -1092,7 +1125,7 @@ fhandler_dev_dsp::write (const void *ptr, size_t len)
}
void __reg3
-fhandler_dev_dsp::read (void *ptr, size_t& len)
+fhandler_dev_dsp::_read (void *ptr, size_t& len)
{
debug_printf ("ptr=%p len=%ld", ptr, len);
@@ -1159,7 +1192,7 @@ fhandler_dev_dsp::close ()
}
int
-fhandler_dev_dsp::ioctl (unsigned int cmd, void *buf)
+fhandler_dev_dsp::_ioctl (unsigned int cmd, void *buf)
{
debug_printf ("audio_in=%p audio_out=%p", audio_in_, audio_out_);
int *intbuf = (int *) buf;
@@ -1362,7 +1395,7 @@ fhandler_dev_dsp::ioctl (unsigned int cmd, void *buf)
}
void
-fhandler_dev_dsp::fixup_after_fork (HANDLE parent)
+fhandler_dev_dsp::_fixup_after_fork (HANDLE parent)
{ // called from new child process
debug_printf ("audio_in=%p audio_out=%p",
audio_in_, audio_out_);
@@ -1375,7 +1408,7 @@ fhandler_dev_dsp::fixup_after_fork (HANDLE parent)
}
void
-fhandler_dev_dsp::fixup_after_exec ()
+fhandler_dev_dsp::_fixup_after_exec ()
{
debug_printf ("audio_in=%p audio_out=%p, close_on_exec %d",
audio_in_, audio_out_, close_on_exec ());