mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-06-30 06:35:23 +00:00
Fix: Fixed a race condition in event_shutdown()
This commit is contained in:
parent
f20dfcef63
commit
07899c4aab
|
@ -209,6 +209,8 @@ void event_initialise(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_shutdown(void) {
|
void event_shutdown(void) {
|
||||||
|
event_t *event_queue_to_free = NULL;
|
||||||
|
|
||||||
/* stop thread */
|
/* stop thread */
|
||||||
if (!event_running)
|
if (!event_running)
|
||||||
return;
|
return;
|
||||||
|
@ -223,10 +225,12 @@ void event_shutdown(void) {
|
||||||
/* shutdown everything */
|
/* shutdown everything */
|
||||||
thread_mutex_lock(&event_lock);
|
thread_mutex_lock(&event_lock);
|
||||||
event_thread = NULL;
|
event_thread = NULL;
|
||||||
event_release(event_queue);
|
event_queue_to_free = event_queue;
|
||||||
event_queue = NULL;
|
event_queue = NULL;
|
||||||
thread_mutex_unlock(&event_lock);
|
thread_mutex_unlock(&event_lock);
|
||||||
|
|
||||||
|
event_release(event_queue_to_free);
|
||||||
|
|
||||||
/* destry mutex */
|
/* destry mutex */
|
||||||
thread_mutex_destroy(&event_lock);
|
thread_mutex_destroy(&event_lock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user