[svn] gpgme - r1184 - trunk/gpgme

svn author marcus cvs at cvs.gnupg.org
Mon Oct 23 20:52:15 CEST 2006


Author: marcus
Date: 2006-10-23 20:52:14 +0200 (Mon, 23 Oct 2006)
New Revision: 1184

Modified:
   trunk/gpgme/ChangeLog
   trunk/gpgme/wait-global.c
Log:
2006-10-23  Marcus Brinkmann  <marcus at g10code.de>

	* wait-global.c (gpgme_wait): Unlock CTX_LIST_LOCK while calling
	_gpgme_engine_io_event().


Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog	2006-10-23 17:17:25 UTC (rev 1183)
+++ trunk/gpgme/ChangeLog	2006-10-23 18:52:14 UTC (rev 1184)
@@ -1,5 +1,8 @@
 2006-10-23  Marcus Brinkmann  <marcus at g10code.de>
 
+	* wait-global.c (gpgme_wait): Unlock CTX_LIST_LOCK while calling
+	_gpgme_engine_io_event().
+
 	* keylist.c (gpgme_op_keylist_next): Return error if OPD is NULL.
 
 2006-09-25  Marcus Brinkmann  <marcus at g10code.de>

Modified: trunk/gpgme/wait-global.c
===================================================================
--- trunk/gpgme/wait-global.c	2006-10-23 17:17:25 UTC (rev 1183)
+++ trunk/gpgme/wait-global.c	2006-10-23 18:52:14 UTC (rev 1184)
@@ -334,6 +334,7 @@
 
       /* Now some contexts might have finished successfully.  */
       LOCK (ctx_list_lock);
+    retry:
       for (li = ctx_active_list; li; li = li->next)
 	{
 	  gpgme_ctx_t actx = li->ctx;
@@ -344,7 +345,19 @@
 	  if (i == actx->fdt.size)
 	    {
 	      gpgme_error_t err = 0;
+
+	      /* FIXME: This does not perform too well.  We have to
+		 release the lock because the I/O event handler
+		 acquires it to remove the context from the active
+		 list.  Two alternative strategies are worth
+		 considering: Either implement the DONE event handler
+		 here in a lock-free manner, or save a list of all
+		 contexts to be released and call the DONE events
+		 afterwards.  */
+	      UNLOCK (ctx_list_lock);
 	      _gpgme_engine_io_event (actx->engine, GPGME_EVENT_DONE, &err);
+	      LOCK (ctx_list_lock);
+	      goto retry;
 	    }
 	}
       UNLOCK (ctx_list_lock);




More information about the Gnupg-commits mailing list