summaryrefslogtreecommitdiff
path: root/recordmydesktop/src/register_callbacks.c
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-01-29 21:15:32 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-01-29 21:15:32 +0000
commit17979ae99228dd0422c26e366d6453663b9664a4 (patch)
tree589dc742d8fbfdbdd034517dbbccc0e290789047 /recordmydesktop/src/register_callbacks.c
parent6ddb091a949d1c7ef107307aedf980bc34f6aa57 (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/register_callbacks.c')
-rw-r--r--recordmydesktop/src/register_callbacks.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/recordmydesktop/src/register_callbacks.c b/recordmydesktop/src/register_callbacks.c
index 27244fe..7f8d04f 100644
--- a/recordmydesktop/src/register_callbacks.c
+++ b/recordmydesktop/src/register_callbacks.c
@@ -32,6 +32,7 @@ void SetExpired(int signum){
if(capture_busy){
frames_lost++;
}
+ pthread_mutex_lock(&time_mutex);
pthread_cond_broadcast(time_cond); //sig handlers should
//not call this func
//could be a set_expired
@@ -39,6 +40,7 @@ void SetExpired(int signum){
//doing a while(running)
//if set_expired broadcast
//else usleep(n)
+ pthread_mutex_unlock(&time_mutex);
}
}
@@ -46,19 +48,10 @@ void SetPaused(int signum){
if(!Paused)
Paused=1;
else{
-// pthread_cond_broadcast(pause_cond);//this should work,
-// but it doesn't
- int i; //this is a bug
- Paused=0; //normally with the broadcast
- //all the threads should restart,
- //but sound capture thread
- for(i=0;i<15;i++) //remains dead. If a bunch of signals,
- pthread_cond_signal(pause_cond);//restarts all threads,
- //why can't a broadcast
- //do the same?
- //if you have any idea
- //please contact me.
- //(misses the signal?)
+ Paused=0;
+ pthread_mutex_lock(&pause_mutex);
+ pthread_cond_broadcast(pause_cond);
+ pthread_mutex_unlock(&pause_mutex);
}
}
© All Rights Reserved