[mutter/gbsneto/clutter-cleanups: 10/10] clutter/main: Simplify thead lock handling
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/clutter-cleanups: 10/10] clutter/main: Simplify thead lock handling
- Date: Mon, 1 Jul 2019 22:09:00 +0000 (UTC)
commit 7ed73ebd048112ee26497b1dee30bda5254789e9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Jun 30 18:00:42 2019 -0300
clutter/main: Simplify thead lock handling
Now that there are only the default thread functions in
place, we don't need to store them.
clutter/clutter/clutter-main.c | 46 +++++++++++-------------------------------
1 file changed, 12 insertions(+), 34 deletions(-)
---
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 6dc36e3c8..0fad6c642 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -85,8 +85,6 @@ G_LOCK_DEFINE_STATIC (ClutterCntx);
/* main lock and locking/unlocking functions */
static GMutex clutter_threads_mutex;
-static GCallback clutter_threads_lock = NULL;
-static GCallback clutter_threads_unlock = NULL;
/* command line options */
static gboolean clutter_is_initialized = FALSE;
@@ -146,38 +144,10 @@ static const GDebugKey clutter_paint_debug_keys[] = {
{ "damage-region", CLUTTER_DEBUG_PAINT_DAMAGE_REGION },
};
-static void
-clutter_threads_impl_lock (void)
-{
- g_mutex_lock (&clutter_threads_mutex);
-}
-
-static void
-clutter_threads_impl_unlock (void)
-{
- /* we need to trylock here, in case the lock hasn't been acquired; on
- * various systems trying to release a mutex that hasn't been acquired
- * will cause a run-time error. trylock() will either fail, in which
- * case we can release the lock we own; or it will succeeds, in which
- * case we need to release the lock we just acquired. so we ignore the
- * returned value.
- *
- * see: https://bugs.gnome.org/679439
- */
- g_mutex_trylock (&clutter_threads_mutex);
- g_mutex_unlock (&clutter_threads_mutex);
-}
-
static inline void
clutter_threads_init_default (void)
{
g_mutex_init (&clutter_threads_mutex);
-
- if (clutter_threads_lock == NULL)
- clutter_threads_lock = clutter_threads_impl_lock;
-
- if (clutter_threads_unlock == NULL)
- clutter_threads_unlock = clutter_threads_impl_unlock;
}
#define ENVIRONMENT_GROUP "Environment"
@@ -922,15 +892,23 @@ clutter_threads_add_timeout (guint interval,
void
_clutter_threads_acquire_lock (void)
{
- if (clutter_threads_lock != NULL)
- (* clutter_threads_lock) ();
+ g_mutex_lock (&clutter_threads_mutex);
}
void
_clutter_threads_release_lock (void)
{
- if (clutter_threads_unlock != NULL)
- (* clutter_threads_unlock) ();
+ /* we need to trylock here, in case the lock hasn't been acquired; on
+ * various systems trying to release a mutex that hasn't been acquired
+ * will cause a run-time error. trylock() will either fail, in which
+ * case we can release the lock we own; or it will succeeds, in which
+ * case we need to release the lock we just acquired. so we ignore the
+ * returned value.
+ *
+ * see: https://bugs.gnome.org/679439
+ */
+ g_mutex_trylock (&clutter_threads_mutex);
+ g_mutex_unlock (&clutter_threads_mutex);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]