check for signalled event before pthread_cond_wait-ing
fixes a deadlock in obs_free_video/obs_video_thread where video_output_stop would signal the update event before obs_video_thread enters video_output_wait (the thread calling obs_free_video would block on pthread_join and obs_video_thread would block on pthread_cond_wait)master
parent
25acf095ab
commit
7fa7af6c03
|
@ -83,7 +83,8 @@ static inline int event_wait(event_t *event)
|
|||
{
|
||||
int code = 0;
|
||||
pthread_mutex_lock(&event->mutex);
|
||||
if ((code = pthread_cond_wait(&event->cond, &event->mutex)) == 0) {
|
||||
if (event->signalled ||
|
||||
(code = pthread_cond_wait(&event->cond, &event->mutex)) == 0) {
|
||||
if (!event->manual)
|
||||
event->signalled = false;
|
||||
pthread_mutex_unlock(&event->mutex);
|
||||
|
|
Loading…
Reference in New Issue