diff options
author | Greg Ward <gward@python.net> | 2003-05-26 22:47:30 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2003-05-26 22:47:30 (GMT) |
commit | b804390ae386a5c8dbd3c107f0f22ab589d3563b (patch) | |
tree | 722678c7c4a74a5881a194a3873e792d4f903e95 | |
parent | 8d1f11b0ef7ec31db75a4e640e9dfd75fc4ee08d (diff) | |
download | cpython-b804390ae386a5c8dbd3c107f0f22ab589d3563b.zip cpython-b804390ae386a5c8dbd3c107f0f22ab589d3563b.tar.gz cpython-b804390ae386a5c8dbd3c107f0f22ab589d3563b.tar.bz2 |
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()
-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 6196d36..139c4cf 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); |