[Goodies-commits] r5235 - xfce4-mailwatch-plugin/trunk/libmailwatch-core
Brian Tarricone
kelnos at xfce.org
Sat Aug 16 10:48:10 CEST 2008
Author: kelnos
Date: 2008-08-16 08:48:10 +0000 (Sat, 16 Aug 2008)
New Revision: 5235
Modified:
xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-common.c
Log:
use a GStaticMutex instead of GMutex to simplify some code and memory handling
Modified: xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-common.c
===================================================================
--- xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-common.c 2008-08-16 08:47:59 UTC (rev 5234)
+++ xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-common.c 2008-08-16 08:48:10 UTC (rev 5235)
@@ -24,7 +24,7 @@
#include "mailwatch-common.h"
-static GMutex *big_happy_mailwatch_mx = NULL;
+static GStaticMutex big_happy_mailwatch_mx = G_STATIC_MUTEX_INIT;
GQuark
xfce_mailwatch_get_error_quark()
@@ -40,26 +40,10 @@
void
xfce_mailwatch_threads_enter()
{
- if(G_UNLIKELY(!big_happy_mailwatch_mx))
- big_happy_mailwatch_mx = g_mutex_new();
-
- g_mutex_lock(big_happy_mailwatch_mx);
+ g_static_mutex_lock(&big_happy_mailwatch_mx);
}
void xfce_mailwatch_threads_leave()
{
- g_return_if_fail(big_happy_mailwatch_mx);
-
- g_mutex_unlock(big_happy_mailwatch_mx);
+ g_static_mutex_unlock(&big_happy_mailwatch_mx);
}
-
-/* FIXME: this might not be a good idea */
-G_MODULE_EXPORT void
-g_module_unload(GModule *module)
-{
- if(big_happy_mailwatch_mx) {
- g_mutex_free(big_happy_mailwatch_mx);
- big_happy_mailwatch_mx = NULL;
- }
-}
-
More information about the Goodies-commits
mailing list