[svn-commits] fjoe: freebsd/trunk r9207 - /freebsd/trunk/freebsd/dahdi/bsd-compat.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 30 15:10:40 CDT 2010


Author: fjoe
Date: Mon Aug 30 15:10:38 2010
New Revision: 9207

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9207
Log:
Fix completion API so that completions are reusable.

Modified:
    freebsd/trunk/freebsd/dahdi/bsd-compat.c

Modified: freebsd/trunk/freebsd/dahdi/bsd-compat.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/freebsd/dahdi/bsd-compat.c?view=diff&rev=9207&r1=9206&r2=9207
==============================================================================
--- freebsd/trunk/freebsd/dahdi/bsd-compat.c (original)
+++ freebsd/trunk/freebsd/dahdi/bsd-compat.c Mon Aug 30 15:10:38 2010
@@ -196,6 +196,7 @@
 	mtx_lock(&c->lock);
 	if (!c->done)
 		cv_wait(&c->cv, &c->lock);
+	c->done--;
 	mtx_unlock(&c->lock);
 }
 
@@ -207,6 +208,8 @@
 	mtx_lock(&c->lock);
 	if (!c->done)
 		res = cv_timedwait(&c->cv, &c->lock, timeout);
+	if (res == 0)
+		c->done--;
 	mtx_unlock(&c->lock);
 	return res == 0;
 }
@@ -215,7 +218,7 @@
 complete(struct completion *c)
 {
 	mtx_lock(&c->lock);
-	c->done = 1;
+	c->done++;
 	cv_signal(&c->cv);
 	mtx_unlock(&c->lock);
 }




More information about the svn-commits mailing list