[Python-checkins] python/dist/src/Modules ossaudiodev.c,1.28,1.29
gward@users.sourceforge.net
gward@users.sourceforge.net
Mon, 26 May 2003 18:57:23 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv13318
Modified Files:
ossaudiodev.c
Log Message:
Oops, move the GIL release/reacquire from oss_sync() to _do_ioctl_0():
that way it applies to *only* the ioctl() call, and also happens for the
other blocking ioctls (POST, RESET).
Index: ossaudiodev.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** ossaudiodev.c 26 May 2003 22:47:30 -0000 1.28
--- ossaudiodev.c 27 May 2003 01:57:21 -0000 1.29
***************
*** 292,295 ****
--- 292,296 ----
{
char argfmt[32] = ":";
+ int rv;
assert(strlen(fname) <= 30);
***************
*** 298,302 ****
return NULL;
! if (ioctl(fd, cmd, 0) == -1)
return PyErr_SetFromErrno(PyExc_IOError);
Py_INCREF(Py_None);
--- 299,311 ----
return NULL;
! /* According to hannu@opensound.com, all three of the ioctls that
! use this function can block, so release the GIL. This is
! especially important for SYNC, which can block for several
! seconds. */
! Py_BEGIN_ALLOW_THREADS
! rv = ioctl(fd, cmd, 0);
! Py_END_ALLOW_THREADS
!
! if (rv == -1)
return PyErr_SetFromErrno(PyExc_IOError);
Py_INCREF(Py_None);
***************
*** 354,363 ****
oss_sync(oss_audio_t *self, PyObject *args)
{
! int rv;
!
! Py_BEGIN_ALLOW_THREADS
! rv = _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC);
! Py_END_ALLOW_THREADS
! return rv;
}
--- 363,367 ----
oss_sync(oss_audio_t *self, PyObject *args)
{
! return _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC);
}