[asterisk-commits] russell: branch russell/sched_thread2 r171449 - /team/russell/sched_thread2/m...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 26 15:06:10 CST 2009


Author: russell
Date: Mon Jan 26 15:06:10 2009
New Revision: 171449

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=171449
Log:
We need to hold the lock before adding the scheduler entry, d'oh

Modified:
    team/russell/sched_thread2/main/sched.c

Modified: team/russell/sched_thread2/main/sched.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/sched_thread2/main/sched.c?view=diff&rev=171449&r1=171448&r2=171449
==============================================================================
--- team/russell/sched_thread2/main/sched.c (original)
+++ team/russell/sched_thread2/main/sched.c Mon Jan 26 15:06:10 2009
@@ -188,11 +188,12 @@
 {
 	int res;
 
+	ast_mutex_lock(&st->lock);
 	res = ast_sched_add_variable(st->context, when, cb, data, variable);
-
 	if (res != -1) {
-		ast_sched_thread_poke(st);
-	}
+		ast_cond_signal(&st->cond);
+	}
+	ast_mutex_unlock(&st->lock);
 
 	return res;
 }
@@ -202,11 +203,12 @@
 {
 	int res;
 
+	ast_mutex_lock(&st->lock);
 	res = ast_sched_add(st->context, when, cb, data);
-
 	if (res != -1) {
-		ast_sched_thread_poke(st);
-	}
+		ast_cond_signal(&st->cond);
+	}
+	ast_mutex_unlock(&st->lock);
 
 	return res;
 }




More information about the asterisk-commits mailing list