提交 7fa7af6c 编写于 作者: P Palana

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)
上级 25acf095
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册