[gimp] libgimpbase: remove the gimp protocol mutex and gp_lock()/gp_unlock()



commit 888c42fbb8ba4a7b109472e14dadc738a29f7593
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 4 22:42:15 2019 +0200

    libgimpbase: remove the gimp protocol mutex and gp_lock()/gp_unlock()
    
    The protocol is supposed to be used recursively, the locks just
    deadlock in some situations. Threaded use of the wire protocol is
    simply forbidden.

 libgimp/gimp.c                  |  2 --
 libgimp/gimptilebackendplugin.c |  4 ----
 libgimpbase/gimpbase.def        |  2 --
 libgimpbase/gimpprotocol.c      | 15 ---------------
 libgimpbase/gimpprotocol.h      |  2 --
 5 files changed, 25 deletions(-)
---
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index 0574071179..357ff269f3 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -806,7 +806,6 @@ gimp_run_procedure_with_array (const gchar    *name,
   proc_run.nparams = gimp_value_array_length (arguments);
   proc_run.params  = _gimp_value_array_to_gp_params (arguments, FALSE);
 
-  gp_lock ();
   if (! gp_proc_run_write (_gimp_writechannel, &proc_run, NULL))
     gimp_quit ();
 
@@ -814,7 +813,6 @@ gimp_run_procedure_with_array (const gchar    *name,
     _gimp_plug_in_read_expect_msg (PLUG_IN, &msg, GP_PROC_RETURN);
   else
     _gimp_read_expect_msg (&msg, GP_PROC_RETURN);
-  gp_unlock ();
 
   proc_return = msg.data;
 
diff --git a/libgimp/gimptilebackendplugin.c b/libgimp/gimptilebackendplugin.c
index 140fe0e707..7c0f22c737 100644
--- a/libgimp/gimptilebackendplugin.c
+++ b/libgimp/gimptilebackendplugin.c
@@ -334,7 +334,6 @@ gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
   tile_req.tile_num    = tile->tile_num;
   tile_req.shadow      = priv->shadow;
 
-  gp_lock ();
   if (! gp_tile_req_write (_gimp_writechannel, &tile_req, NULL))
     gimp_quit ();
 
@@ -384,7 +383,6 @@ gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
 
   if (! gp_tile_ack_write (_gimp_writechannel, NULL))
     gimp_quit ();
-  gp_unlock ();
 
   gimp_wire_destroy (&msg);
 }
@@ -404,7 +402,6 @@ gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
   tile_req.tile_num    = 0;
   tile_req.shadow      = 0;
 
-  gp_lock ();
   if (! gp_tile_req_write (_gimp_writechannel, &tile_req, NULL))
     gimp_quit ();
 
@@ -447,7 +444,6 @@ gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
     _gimp_plug_in_read_expect_msg (plug_in, &msg, GP_TILE_ACK);
   else
     _gimp_read_expect_msg (&msg, GP_TILE_ACK);
-  gp_unlock ();
 
   gimp_wire_destroy (&msg);
 }
diff --git a/libgimpbase/gimpbase.def b/libgimpbase/gimpbase.def
index 7bc6e9d2dc..82c711dd49 100644
--- a/libgimpbase/gimpbase.def
+++ b/libgimpbase/gimpbase.def
@@ -279,7 +279,6 @@ EXPORTS
        gp_extension_ack_write
        gp_has_init_write
        gp_init
-       gp_lock
        gp_proc_install_write
        gp_proc_return_write
        gp_proc_run_write
@@ -290,4 +289,3 @@ EXPORTS
        gp_tile_ack_write
        gp_tile_data_write
        gp_tile_req_write
-       gp_unlock
diff --git a/libgimpbase/gimpprotocol.c b/libgimpbase/gimpprotocol.c
index 5abd904298..0eb2bf6ce2 100644
--- a/libgimpbase/gimpprotocol.c
+++ b/libgimpbase/gimpprotocol.c
@@ -27,7 +27,6 @@
 #include "gimpprotocol.h"
 #include "gimpwire.h"
 
-static GMutex readwrite_mutex;
 
 static void _gp_quit_read                (GIOChannel       *channel,
                                           GimpWireMessage  *msg,
@@ -204,20 +203,6 @@ gp_init (void)
                       _gp_has_init_destroy);
 }
 
-/* lock/unlock the global wire mutex */
-
-void
-gp_lock (void)
-{
-  g_mutex_lock (&readwrite_mutex);
-}
-
-void
-gp_unlock (void)
-{
-  g_mutex_unlock (&readwrite_mutex);
-}
-
 /* public writing API */
 
 gboolean
diff --git a/libgimpbase/gimpprotocol.h b/libgimpbase/gimpprotocol.h
index a9a29cde11..263c0725ae 100644
--- a/libgimpbase/gimpprotocol.h
+++ b/libgimpbase/gimpprotocol.h
@@ -277,8 +277,6 @@ struct _GPProcUninstall
 
 
 void      gp_init                   (void);
-void      gp_lock                   (void);
-void      gp_unlock                 (void);
 
 gboolean  gp_quit_write             (GIOChannel      *channel,
                                      gpointer         user_data);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]