From 17979ae99228dd0422c26e366d6453663b9664a4 Mon Sep 17 00:00:00 2001 From: iovar Date: Mon, 29 Jan 2007 21:15:32 +0000 Subject: Fixed all condition variables, to be waited with correct mutexes. This fixed also the wakeup from pause bug. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@269 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/cache_frame.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'recordmydesktop/src/cache_frame.c') diff --git a/recordmydesktop/src/cache_frame.c b/recordmydesktop/src/cache_frame.c index d57ecfd..6eb169a 100644 --- a/recordmydesktop/src/cache_frame.c +++ b/recordmydesktop/src/cache_frame.c @@ -96,9 +96,6 @@ int FlushBlock(unsigned char *buf, } void *CacheImageBuffer(ProgData *pdata){ - pthread_mutex_t pmut,imut; - pthread_mutex_init(&pmut,NULL); - pthread_mutex_init(&imut,NULL); yuv_buffer yuv[2]; gzFile *fp=NULL; FILE *ucfp=NULL; @@ -144,11 +141,18 @@ void *CacheImageBuffer(ProgData *pdata){ ynum=unum=vnum=0; pdata->th_enc_thread_waiting=1; - pthread_cond_wait(&pdata->image_buffer_ready,&imut); + pthread_mutex_lock(&pdata->img_buff_ready_mutex); + pthread_cond_wait(&pdata->image_buffer_ready, + &pdata->img_buff_ready_mutex); + pthread_mutex_unlock(&pdata->img_buff_ready_mutex); pdata->th_enc_thread_waiting=0; - if(Paused) - pthread_cond_wait(&pdata->pause_cond,&pmut); + if(Paused){ + pthread_mutex_lock(&pause_mutex); + pthread_cond_wait(&pdata->pause_cond,&pause_mutex); + pthread_mutex_unlock(&pause_mutex); + } + pthread_mutex_lock(&pdata->yuv_mutex); //rotate buffers -- cgit v1.2.1