Commit 07899c4a authored by Philipp Schafft's avatar Philipp Schafft

Fix: Fixed a race condition in event_shutdown()

parent f20dfcef
Pipeline #331 failed with stage
in 11 seconds
......@@ -209,6 +209,8 @@ void event_initialise(void) {
}
void event_shutdown(void) {
event_t *event_queue_to_free = NULL;
/* stop thread */
if (!event_running)
return;
......@@ -223,10 +225,12 @@ void event_shutdown(void) {
/* shutdown everything */
thread_mutex_lock(&event_lock);
event_thread = NULL;
event_release(event_queue);
event_queue_to_free = event_queue;
event_queue = NULL;
thread_mutex_unlock(&event_lock);
event_release(event_queue_to_free);
/* destry mutex */
thread_mutex_destroy(&event_lock);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment