mirror of
https://github.com/larsimmisch/pyalsaaudio.git
synced 2026-06-01 10:57:01 +00:00
reduce scope of GIL releases
it's pointless to enclose snd_pcm_close() and snd_pcm_pause(), as these calls don't sleep.
This commit is contained in:
+4
-6
@@ -515,11 +515,12 @@ alsapcm_close(alsapcm_t *self, PyObject *args)
|
|||||||
|
|
||||||
if (self->handle)
|
if (self->handle)
|
||||||
{
|
{
|
||||||
Py_BEGIN_ALLOW_THREADS
|
if (self->pcmtype == SND_PCM_STREAM_PLAYBACK) {
|
||||||
if (self->pcmtype == SND_PCM_STREAM_PLAYBACK)
|
Py_BEGIN_ALLOW_THREADS
|
||||||
snd_pcm_drain(self->handle);
|
snd_pcm_drain(self->handle);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
|
}
|
||||||
snd_pcm_close(self->handle);
|
snd_pcm_close(self->handle);
|
||||||
Py_END_ALLOW_THREADS
|
|
||||||
|
|
||||||
self->handle = 0;
|
self->handle = 0;
|
||||||
}
|
}
|
||||||
@@ -1476,10 +1477,7 @@ static PyObject *alsapcm_pause(alsapcm_t *self, PyObject *args)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
|
||||||
res = snd_pcm_pause(self->handle, enabled);
|
res = snd_pcm_pause(self->handle, enabled);
|
||||||
Py_END_ALLOW_THREADS
|
|
||||||
|
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
{
|
{
|
||||||
PyErr_Format(ALSAAudioError, "%s [%s]", snd_strerror(res),
|
PyErr_Format(ALSAAudioError, "%s [%s]", snd_strerror(res),
|
||||||
|
|||||||
Reference in New Issue
Block a user