[svn-commits] mmichelson: branch mmichelson/threadpool r377654 - /team/mmichelson/threadpoo...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Dec 10 09:55:59 CST 2012


Author: mmichelson
Date: Mon Dec 10 09:55:56 2012
New Revision: 377654

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=377654
Log:
Improve timedwaits in tests to actually behave like they should.


Modified:
    team/mmichelson/threadpool/tests/test_threadpool.c

Modified: team/mmichelson/threadpool/tests/test_threadpool.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/tests/test_threadpool.c?view=diff&rev=377654&r1=377653&r2=377654
==============================================================================
--- team/mmichelson/threadpool/tests/test_threadpool.c (original)
+++ team/mmichelson/threadpool/tests/test_threadpool.c Mon Dec 10 09:55:56 2012
@@ -157,7 +157,9 @@
 	SCOPED_MUTEX(lock, &tld->lock);
 
 	while (!tld->task_pushed) {
-		ast_cond_timedwait(&tld->cond, lock, &end);
+		if (ast_cond_timedwait(&tld->cond, lock, &end) == ETIMEDOUT) {
+			break;
+		}
 	}
 }
 
@@ -172,7 +174,9 @@
 	SCOPED_MUTEX(lock, &std->lock);
 
 	while (!std->task_executed) {
-		ast_cond_timedwait(&std->cond, lock, &end);
+		if (ast_cond_timedwait(&std->cond, lock, &end) == ETIMEDOUT) {
+			break;
+		}
 	}
 
 	if (!std->task_executed) {
@@ -193,7 +197,9 @@
 	SCOPED_MUTEX(lock, &tld->lock);
 
 	while (!tld->empty_notice) {
-		ast_cond_timedwait(&tld->cond, lock, &end);
+		if (ast_cond_timedwait(&tld->cond, lock, &end) == ETIMEDOUT) {
+			break;
+		}
 	}
 
 	if (!tld->empty_notice) {
@@ -840,7 +846,9 @@
 	SCOPED_MUTEX(lock, &ctd->lock);
 
 	while (!ctd->task_executed) {
-		ast_cond_timedwait(&ctd->done_cond, lock, &end);
+		if (ast_cond_timedwait(&ctd->done_cond, lock, &end) == ETIMEDOUT) {
+			break;
+		}
 	}
 
 	if (!ctd->task_executed) {




More information about the svn-commits mailing list