diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-01-29 21:15:32 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-01-29 21:15:32 +0000 |
commit | 17979ae99228dd0422c26e366d6453663b9664a4 (patch) | |
tree | 589dc742d8fbfdbdd034517dbbccc0e290789047 /recordmydesktop/src/cache_frame.c | |
parent | 6ddb091a949d1c7ef107307aedf980bc34f6aa57 (diff) |
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
Diffstat (limited to 'recordmydesktop/src/cache_frame.c')
-rw-r--r-- | recordmydesktop/src/cache_frame.c | 16 |
1 files changed, 10 insertions, 6 deletions
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 |