diff options
author | Greg Ward <gward@python.net> | 2003-05-26 22:47:30 +0000 |
---|---|---|
committer | Greg Ward <gward@python.net> | 2003-05-26 22:47:30 +0000 |
commit | be2ca8bb27ce7646971c7e893144561bcbd3b362 (patch) | |
tree | a97b216d50e14db7cb1eac3d3670b146b3d1eda2 /Modules/ossaudiodev.c | |
parent | 0ab359e58063d9d2aa4154b2c79b7f5a36396dbe (diff) | |
download | cpython-be2ca8bb27ce7646971c7e893144561bcbd3b362.tar.gz |
Release the GIL in two more methods:
* sync(), because it waits for hardware buffers to flush, which
can take several seconds depending on cirumstances (according
to the OSS docs)
* close(), because it does an implicit sync()
Diffstat (limited to 'Modules/ossaudiodev.c')
-rw-r--r-- | Modules/ossaudiodev.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index 6196d36739..139c4cfa82 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -353,7 +353,12 @@ oss_speed(oss_audio_t *self, PyObject *args) static PyObject * oss_sync(oss_audio_t *self, PyObject *args) { - return _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC); + int rv; + + Py_BEGIN_ALLOW_THREADS + rv = _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC); + Py_END_ALLOW_THREADS + return rv; } static PyObject * @@ -478,7 +483,9 @@ oss_close(oss_audio_t *self, PyObject *args) return NULL; if (self->fd >= 0) { + Py_BEGIN_ALLOW_THREADS close(self->fd); + Py_END_ALLOW_THREADS self->fd = -1; } Py_INCREF(Py_None); |