external/gpgmepp/macos-tdf152524.patch |   38 +++------------------------------
 1 file changed, 4 insertions(+), 34 deletions(-)

New commits:
commit 3b4a8977652b7e69469d0e56e12de50e07ceae2f
Author:     Patrick Luby <guibomac...@gmail.com>
AuthorDate: Thu Feb 22 16:13:45 2024 +0100
Commit:     Patrick Luby <guibomac...@gmail.com>
CommitDate: Fri Feb 23 00:08:02 2024 +0100

    Revert "tdf#152524 use dispatch_async() instead of dispatch_sync()"
    
    This reverts commit b0656e6ca668a0719fbcb71b6d46c68093dda470.
    
    Reason for revert: This patch has not made any positive difference for 
tdf#152524.
    
    Change-Id: I5ea0f80263188049f06623ac930b4dc7856dc53e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163758
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>

diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
index ad6fbf8fe9cb..a69fbd1cf139 100644
--- a/external/gpgmepp/macos-tdf152524.patch
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -1,18 +1,17 @@
 --- src/posix-io.c     2023-02-01 11:50:48
 +++ src/posix-io.c     2024-02-05 19:16:00
-@@ -62,6 +62,11 @@
+@@ -62,6 +62,10 @@
  # endif
  #endif
  #include <sys/socket.h>
 +
 +#if HAVE_MACOS_SYSTEM
 +#include <dispatch/dispatch.h>
-+#include <pthread.h>
 +#endif
  
  #include "util.h"
  #include "priv-io.h"
-@@ -517,12 +522,79 @@
+@@ -517,12 +521,50 @@
  }
  
  
@@ -39,47 +38,18 @@
 +       * run in a sequential queue in a non-main thread.  */
 +      static dispatch_queue_t queue = NULL;
 +      if (!queue)
-+              queue = dispatch_queue_create ("gpgmeppforkandexec",
++              queue = dispatch_queue_create ("gpgmepp",
 +                                             DISPATCH_QUEUE_CONCURRENT);
 +      if (!queue)
 +              return -1;
 +
 +      __block int ret = -1;
-+      __block int done = false;
-+      __block pthread_mutex_t waitlock = PTHREAD_MUTEX_INITIALIZER;
-+      __block pthread_cond_t waitcond = PTHREAD_COND_INITIALIZER;
-+
-+      if (pthread_mutex_lock(&waitlock))
-+              return -1;
-+
-+      /* Use dispatch_async() to force the queue to run in a separate
-+       * thread.  */
-+      dispatch_async(queue, ^{
-+              if (pthread_mutex_lock(&waitlock))
-+              {
-+                      done = true;
-+                      pthread_cond_signal(&waitcond);
-+                      return;
-+              }
-+
++      dispatch_sync(queue, ^{
 +              ret = _gpgme_io_spawn_macos (path, argv, flags,
 +                                           fd_list, atfork,
 +                                           atforkvalue, r_pid);
-+
-+              done = true;
-+              pthread_cond_signal(&waitcond);
-+              pthread_mutex_unlock(&waitlock);
 +      });
 +
-+      /* dispatch_async_and_wait() doesn't necessarily force the queue
-+       * to run in a separate thread so block and until the task has
-+       * finished.  */
-+      if (!done)
-+              pthread_cond_wait(&waitcond, &waitlock);
-+      pthread_cond_destroy(&waitcond);
-+      pthread_mutex_unlock(&waitlock);
-+      pthread_mutex_destroy(&waitlock);
-+
 +      return ret;
 +}
 +

Reply via email to