Permalink
Browse files

Don't hold the device mutex, while shuting down coreaudio. As AudioDe…

…viceStop

might block until the callback function returns.
  • Loading branch information...
1 parent 3444c1b commit 9ca8d69d4e65124e95f327e5f5a1cf55080c5133 dalus committed Jan 15, 2011
Showing with 4 additions and 0 deletions.
  1. +2 −0 src/clients/despotify/coreaudio.c
  2. +2 −0 src/clients/simple/coreaudio.c
@@ -191,10 +191,12 @@ int audio_exit(void *private) {
device->playing = 0;
DSFYDEBUG("Currently playing, signalling event and stopping CoreAudio\n");
pthread_cond_signal(&device->event);
+ pthread_mutex_unlock(&device->mutex);
if(AudioDeviceStop (device->adev_id, device->proc_id)) {
DSFYDEBUG ("audio_exit(): AudioDeviceStop() failed\n");
return -1;
}
+ pthread_mutex_lock(&device->mutex);
}
pthread_mutex_unlock(&device->mutex);
@@ -190,10 +190,12 @@ int audio_exit(void *private) {
device->playing = 0;
DSFYDEBUG("Currently playing, signalling event and stopping CoreAudio\n");
pthread_cond_signal(&device->event);
+ pthread_mutex_unlock(&device->mutex);
if(AudioDeviceStop (device->adev_id, device->proc_id)) {
DSFYDEBUG ("audio_exit(): AudioDeviceStop() failed\n");
return -1;
}
+ pthread_mutex_lock(&device->mutex);
}
pthread_mutex_unlock(&device->mutex);

0 comments on commit 9ca8d69

Please sign in to comment.