[libgda] Removed GLIB_CHECK_VERSION as minimum required version is 2.32
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Removed GLIB_CHECK_VERSION as minimum required version is 2.32
- Date: Thu, 9 May 2013 14:34:08 +0000 (UTC)
commit 3472d86d73cf0bbf10108817a748158275312d41
Author: Vivien Malerba <malerba gnome-db org>
Date: Thu May 9 16:03:33 2013 +0200
Removed GLIB_CHECK_VERSION as minimum required version is 2.32
doc/C/libgda-5.0-docs.sgml | 5 +-
libgda-ui/data-entries/gdaui-numeric-entry.c | 24 --
libgda/gda-config.c | 8 +-
libgda/gda-connection.c | 213 +----------
libgda/gda-data-handler.c | 6 -
libgda/gda-data-model.c | 8 +-
libgda/gda-data-pivot.c | 34 +--
libgda/gda-holder.c | 6 +-
libgda/gda-init.c | 18 +-
libgda/gda-lockable.c | 8 +-
libgda/gda-log.c | 8 +-
libgda/gda-meta-store.c | 8 +-
libgda/gda-mutex.c | 393 +-------------------
libgda/gda-mutex.h | 6 +-
libgda/gda-set.c | 10 +-
libgda/gda-sql-builder.c | 6 +-
libgda/gda-value.c | 11 +-
libgda/handlers/gda-handler-numerical.c | 4 -
libgda/sqlite/gda-sqlite-provider.c | 6 +-
libgda/sqlite/gda-sqlite-recordset.c | 6 +-
libgda/sqlite/virtual/gda-vconnection-data-model.c | 26 +--
libgda/thread-wrapper/gda-thread-wrapper.c | 215 +-----------
providers/jdbc/jni-wrapper.c | 25 --
providers/mysql/gda-mysql-provider.c | 6 -
providers/oracle/gda-oracle-util.c | 6 +-
providers/web/gda-web-util.c | 11 +-
tools/browser/browser-connection-priv.h | 6 +-
tools/browser/browser-connection.c | 29 +--
tools/browser/browser-page.c | 8 +-
tools/browser/browser-perspective.c | 8 +-
tools/gda-threader.c | 2 -
31 files changed, 44 insertions(+), 1086 deletions(-)
---
diff --git a/doc/C/libgda-5.0-docs.sgml b/doc/C/libgda-5.0-docs.sgml
index 1b4f76f..2f7ed8e 100644
--- a/doc/C/libgda-5.0-docs.sgml
+++ b/doc/C/libgda-5.0-docs.sgml
@@ -347,9 +347,10 @@
files are shared libraries)</para>
</listitem>
<listitem>
- <para>LIBGDA_NO_THREADS: if set, then multi threading will be disabled (see the
+ <para>LIBGDA_NO_THREADS (useless since version 5.2.0): if set, then multi threading will be
disabled (see the
<link linkend="threads">section about multi threading</link> for more information about
- &LIBGDA; threads' support).</para>
+ &LIBGDA; threads' support). Please note that this environment variables is not used anymore
+ since version 5.2.0, as threading is always enabled by Glib.</para>
</listitem>
<listitem>
<para>GDA_SHOW_PROVIDER_LOADING_ERROR: if set, then in case a provider fails to be loaded
(usually because
diff --git a/libgda-ui/data-entries/gdaui-numeric-entry.c b/libgda-ui/data-entries/gdaui-numeric-entry.c
index de222e7..e73f660 100644
--- a/libgda-ui/data-entries/gdaui-numeric-entry.c
+++ b/libgda-ui/data-entries/gdaui-numeric-entry.c
@@ -277,37 +277,21 @@ gdaui_numeric_entry_set_property (GObject *object,
break;
case PROP_DECIMAL_SEP: {
gchar sep;
-#if GLIB_CHECK_VERSION(2,32,0)
sep = (gchar) g_value_get_schar (value);
-#else
- sep = g_value_get_char (value);
-#endif
if ((sep == 0) || (sep == '+') || (sep == '-'))
g_warning (_("Decimal separator cannot be the '%c' character"), sep ? sep :
'0');
else {
-#if GLIB_CHECK_VERSION(2,32,0)
entry->priv->decimal_sep = (gchar) g_value_get_schar (value);
-#else
- entry->priv->decimal_sep = g_value_get_char (value);
-#endif
}
break;
}
case PROP_THOUSANDS_SEP: {
gchar sep;
-#if GLIB_CHECK_VERSION(2,32,0)
sep = (gchar) g_value_get_schar (value);
-#else
- sep = g_value_get_char (value);
-#endif
if ((sep == '+') || (sep == '-') || (sep == '_'))
g_warning (_("Decimal thousands cannot be the '%c' character"), sep);
else {
-#if GLIB_CHECK_VERSION(2,32,0)
entry->priv->thousands_sep = (gchar) g_value_get_schar (value);
-#else
- entry->priv->thousands_sep = g_value_get_char (value);
-#endif
}
break;
}
@@ -338,18 +322,10 @@ gdaui_numeric_entry_get_property (GObject *object,
g_value_set_uint (value, entry->priv->nb_decimals);
break;
case PROP_DECIMAL_SEP:
-#if GLIB_CHECK_VERSION(2,32,0)
g_value_set_schar (value, (gint8) entry->priv->decimal_sep);
-#else
- g_value_set_char (value, entry->priv->decimal_sep);
-#endif
break;
case PROP_THOUSANDS_SEP:
-#if GLIB_CHECK_VERSION(2,32,0)
g_value_set_schar (value, (gint8) entry->priv->thousands_sep);
-#else
- g_value_set_char (value, entry->priv->thousands_sep);
-#endif
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
diff --git a/libgda/gda-config.c b/libgda/gda-config.c
index f49a437..aafbfdb 100644
--- a/libgda/gda-config.c
+++ b/libgda/gda-config.c
@@ -2,7 +2,7 @@
* Copyright (C) 2000 Akira Tagoh <tagoh src gnome org>
* Copyright (C) 2000 Reinhard Müller <reinhard src gnome org>
* Copyright (C) 2000 - 2005 Rodrigo Moya <rodrigo gnome-db org>
- * Copyright (C) 2001 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2001 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2002 - 2003 Gonzalo Paniagua Javier <gonzalo gnome-db org>
* Copyright (C) 2002 Zbigniew Chyla <cyba gnome pl>
* Copyright (C) 2003 Akira TAGOH <tagoh gnome-db org>
@@ -229,15 +229,9 @@ static void lock_notify_changes (void);
static void unlock_notify_changes (void);
#endif
-#if GLIB_CHECK_VERSION(2,31,7)
static GRecMutex gda_rmutex;
#define GDA_CONFIG_LOCK() g_rec_mutex_lock(&gda_rmutex)
#define GDA_CONFIG_UNLOCK() g_rec_mutex_unlock(&gda_rmutex)
-#else
-static GStaticRecMutex gda_mutex = G_STATIC_REC_MUTEX_INIT;
-#define GDA_CONFIG_LOCK() g_static_rec_mutex_lock(&gda_mutex)
-#define GDA_CONFIG_UNLOCK() g_static_rec_mutex_unlock(&gda_mutex)
-#endif
/* GdaServerProvider for SQLite as a shortcut, available
* even if the SQLite provider is not installed
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 15a68da..aac4b2e 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -2,7 +2,7 @@
* Copyright (C) 2000 - 2001 Reinhard Müller <reinhard src gnome org>
* Copyright (C) 2000 - 2004 Rodrigo Moya <rodrigo gnome-db org>
* Copyright (C) 2001 - 2003 Gonzalo Paniagua Javier <gonzalo gnome-db org>
- * Copyright (C) 2001 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2001 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2002 Andrew Hill <andru src gnome org>
* Copyright (C) 2002 Cleber Rodrigues <cleberrrjr bol com br>
* Copyright (C) 2002 Zbigniew Chyla <cyba gnome pl>
@@ -104,15 +104,9 @@ struct _GdaConnectionPrivate {
/* multi threading locking */
GThread *unique_possible_thread; /* non NULL => only that thread can use this connection
*/
-#if GLIB_CHECK_VERSION(2,31,7)
GCond unique_possible_cond;
GMutex object_mutex;
GRecMutex rmutex;
-#else
- GCond *unique_possible_cond;
- GMutex *object_mutex;
- GdaMutex *mutex;
-#endif
/* Asynchronous statement execution */
guint next_task_id; /* starts at 1 as 0 is an error */
GArray *waiting_tasks; /* array of CncTask pointers to tasks to be executed */
@@ -132,11 +126,7 @@ typedef struct {
guint task_id; /* ID assigned by GdaConnection object */
guint prov_task_id; /* ID assigned by GdaServerProvider */
gboolean being_processed; /* TRUE if currently being processed */
-#if GLIB_CHECK_VERSION(2,31,7)
GRecMutex rmutex;
-#else
- GMutex *mutex;
-#endif
GdaStatement *stmt; /* statement to execute */
GdaStatementModelUsage model_usage;
GType *col_types;
@@ -152,13 +142,8 @@ typedef struct {
static CncTask *cnc_task_new (guint id, GdaStatement *stmt, GdaStatementModelUsage model_usage,
GType *col_types, GdaSet *params, gboolean need_last_insert_row);
static void cnc_task_free (CncTask *task);
-#if GLIB_CHECK_VERSION(2,31,7)
#define cnc_task_lock(task) g_rec_mutex_lock (&((task)->rmutex))
#define cnc_task_unlock(task) g_rec_mutex_unlock (&((task)->rmutex))
-#else
-#define cnc_task_lock(task) g_mutex_lock ((task)->mutex)
-#define cnc_task_unlock(task) g_mutex_unlock ((task)->mutex)
-#endif
static void add_exec_time_to_object (GObject *obj, GTimer *timer);
@@ -498,15 +483,9 @@ gda_connection_init (GdaConnection *cnc, G_GNUC_UNUSED GdaConnectionClass *klass
cnc->priv = g_new0 (GdaConnectionPrivate, 1);
cnc->priv->unique_possible_thread = NULL;
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_init (&cnc->priv->object_mutex);
g_rec_mutex_init (&cnc->priv->rmutex);
g_cond_init (& cnc->priv->unique_possible_cond);
-#else
- cnc->priv->object_mutex = g_mutex_new ();
- cnc->priv->mutex = gda_mutex_new ();
- cnc->priv->unique_possible_cond = NULL;
-#endif
cnc->priv->provider_obj = NULL;
cnc->priv->dsn = NULL;
cnc->priv->cnc_string = NULL;
@@ -635,17 +614,9 @@ gda_connection_finalize (GObject *object)
g_free (cnc->priv->cnc_string);
g_free (cnc->priv->auth_string);
-#if GLIB_CHECK_VERSION(2,31,7)
g_cond_clear (& cnc->priv->unique_possible_cond);
g_mutex_clear (& cnc->priv->object_mutex);
g_rec_mutex_clear (&cnc->priv->rmutex);
-#else
- if (cnc->priv->unique_possible_cond)
- g_cond_free (cnc->priv->unique_possible_cond);
- if (cnc->priv->object_mutex)
- g_mutex_free (cnc->priv->object_mutex);
- gda_mutex_free (cnc->priv->mutex);
-#endif
g_free (cnc->priv);
cnc->priv = NULL;
@@ -736,37 +707,17 @@ gda_connection_set_property (GObject *object,
switch (param_id) {
case PROP_THREAD_OWNER:
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_lock (&cnc->priv->object_mutex);
g_rec_mutex_lock (&cnc->priv->rmutex);
-#else
- g_mutex_lock (cnc->priv->object_mutex);
- gda_mutex_lock (cnc->priv->mutex);
-#endif
cnc->priv->unique_possible_thread = g_value_get_pointer (value);
#ifdef GDA_DEBUG_CNC_LOCK
g_print ("Unique set to %p\n", cnc->priv->unique_possible_thread);
-#endif
-#if GLIB_CHECK_VERSION(2,31,7)
-#ifdef GDA_DEBUG_CNC_LOCK
g_print ("Signalling on %p\n", cnc->priv->unique_possible_cond);
#endif
g_cond_broadcast (& cnc->priv->unique_possible_cond);
-#else
- if (cnc->priv->unique_possible_cond) {
-#ifdef GDA_DEBUG_CNC_LOCK
- g_print ("Signalling on %p\n", cnc->priv->unique_possible_cond);
-#endif
- g_cond_broadcast (cnc->priv->unique_possible_cond);
- }
-#endif
-#if GLIB_CHECK_VERSION(2,31,7)
+
g_rec_mutex_unlock (&cnc->priv->rmutex);
g_mutex_unlock (&cnc->priv->object_mutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
- g_mutex_unlock (cnc->priv->object_mutex);
-#endif
break;
case PROP_DSN: {
const gchar *datasource = g_value_get_string (value);
@@ -852,38 +803,22 @@ gda_connection_set_property (GObject *object,
case PROP_OPTIONS: {
GdaConnectionOptions flags;
flags = g_value_get_flags (value);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&cnc->priv->rmutex);
-#else
- gda_mutex_lock (cnc->priv->mutex);
-#endif
_gda_thread_connection_set_data (cnc, NULL);
if (cnc->priv->provider_data &&
((flags & (~GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE)) !=
(cnc->priv->options &
(~GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE)))) {
g_warning (_("Can't set the '%s' property once the connection is opened"),
pspec->name);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&cnc->priv->rmutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
-#endif
return;
}
cnc->priv->options = flags;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&cnc->priv->rmutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
-#endif
break;
}
case PROP_META_STORE:
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&cnc->priv->rmutex);
-#else
- gda_mutex_lock (cnc->priv->mutex);
-#endif
if (cnc->priv->meta_store) {
g_object_unref (cnc->priv->meta_store);
cnc->priv->meta_store = NULL;
@@ -898,11 +833,7 @@ gda_connection_set_property (GObject *object,
g_object_set (G_OBJECT (cdata->sub_connection), "meta-store",
cnc->priv->meta_store, NULL);
}
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&cnc->priv->rmutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
-#endif
break;
case PROP_IS_THREAD_WRAPPER:
g_warning ("This property should not be modified!");
@@ -1088,11 +1019,7 @@ cnc_task_new (guint id, GdaStatement *stmt, GdaStatementModelUsage model_usage,
task->params = gda_set_copy (params);
task->need_last_insert_row = need_last_insert_row;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_init (&(task->rmutex));
-#else
- task->mutex = g_mutex_new ();
-#endif
return task;
}
@@ -1100,30 +1027,18 @@ cnc_task_new (guint id, GdaStatement *stmt, GdaStatementModelUsage model_usage,
static void
task_stmt_reset_cb (G_GNUC_UNUSED GdaStatement *stmt, CncTask *task)
{
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(task->rmutex));
-#else
- g_mutex_lock (task->mutex);
-#endif
g_signal_handlers_disconnect_by_func (task->stmt,
G_CALLBACK (task_stmt_reset_cb), task);
g_object_unref (task->stmt);
task->stmt = NULL;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(task->rmutex));
-#else
- g_mutex_unlock (task->mutex);
-#endif
}
static void
cnc_task_free (CncTask *task)
{
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(task->rmutex));
-#else
- g_mutex_lock (task->mutex);
-#endif
if (task->stmt) {
g_signal_handlers_disconnect_by_func (task->stmt,
G_CALLBACK (task_stmt_reset_cb), task);
@@ -1142,13 +1057,8 @@ cnc_task_free (CncTask *task)
if (task->exec_timer)
g_timer_destroy (task->exec_timer);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(task->rmutex));
g_rec_mutex_clear (&(task->rmutex));
-#else
- g_mutex_unlock (task->mutex);
- g_mutex_free (task->mutex);
-#endif
g_free (task);
}
@@ -1619,22 +1529,6 @@ gda_connection_open_sqlite (const gchar *directory, const gchar *filename, gbool
return cnc;
}
-#if GLIB_CHECK_VERSION(2,31,7)
-/* this is not necessary anymore */
-#else
-typedef struct {
- gboolean thread_exists;
- GThread *looked_up_thread;
-} ThreadLookupData;
-
-static void
-all_threads_func (GThread *thread, ThreadLookupData *data)
-{
- if (thread == data->looked_up_thread)
- data->thread_exists = TRUE;
-}
-#endif
-
/**
* gda_connection_open:
* @cnc: a #GdaConnection object
@@ -1701,30 +1595,20 @@ gda_connection_open (GdaConnection *cnc, GError **error)
if (PROV_CLASS (cnc->priv->provider_obj)->limiting_thread &&
(PROV_CLASS (cnc->priv->provider_obj)->limiting_thread != g_thread_self ())) {
-#if GLIB_CHECK_VERSION(2,31,7)
+ /* WARNING:
+ * Prior to GLib 2.32, this code used to check if the
+ * PROV_CLASS (cnc->priv->provider_obj)->limiting_thread
+ * was still active (i.e. not finished) and if so, the
+ * PROV_CLASS (cnc->priv->provider_obj)->limiting_thread would
+ * become g_thread_self().
+ *
+ * Now, if PROV_CLASS (cnc->priv->provider_obj)->limiting_thread is set and
+ * if it's not equal to g_thread_self() then an error is returned.
+ */
g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_PROVIDER_ERROR,
"%s", _("Provider does not allow usage from this thread"));
gda_connection_unlock ((GdaLockable*) cnc);
return FALSE;
-#else
- ThreadLookupData data;
- data.thread_exists = FALSE;
- data.looked_up_thread = PROV_CLASS (cnc->priv->provider_obj)->limiting_thread;
-
- g_thread_foreach ((GFunc) all_threads_func, &data);
- if (data.thread_exists) {
- g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_PROVIDER_ERROR,
- "%s", _("Provider does not allow usage from this thread"));
- gda_connection_unlock ((GdaLockable*) cnc);
- return FALSE;
- }
- else {
- /* the thread which initialized cnc->priv->provider_obj does not exist
- * anymore, so we steal ownership of the provider from the current
- * thread */
- PROV_CLASS (cnc->priv->provider_obj)->limiting_thread = g_thread_self ();
- }
-#endif
}
if (!PROV_CLASS (cnc->priv->provider_obj)->open_connection) {
@@ -2636,11 +2520,7 @@ gda_connection_add_event (GdaConnection *cnc, GdaConnectionEvent *event)
g_return_if_fail (GDA_IS_CONNECTION (cnc));
g_return_if_fail (GDA_IS_CONNECTION_EVENT (event));
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (& cnc->priv->rmutex);
-#else
- gda_mutex_lock (cnc->priv->mutex);
-#endif
/* clear external list of events */
if (cnc->priv->events_list) {
@@ -2695,11 +2575,7 @@ gda_connection_add_event (GdaConnection *cnc, GdaConnectionEvent *event)
#ifdef GDA_DEBUG_NO
dump_events_array (cnc);
#endif
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (& cnc->priv->rmutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
-#endif
}
/**
@@ -6406,20 +6282,12 @@ prepared_stms_foreach_func (GdaStatement *gda_stmt, G_GNUC_UNUSED GdaPStmt *prep
static void
statement_weak_notify_cb (GdaConnection *cnc, GdaStatement *stmt)
{
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (& cnc->priv->rmutex);
-#else
- gda_mutex_lock (cnc->priv->mutex);
-#endif
g_assert (cnc->priv->prepared_stmts);
g_hash_table_remove (cnc->priv->prepared_stmts, stmt);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (& cnc->priv->rmutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
-#endif
}
@@ -6582,11 +6450,7 @@ gda_connection_get_meta_store (GdaConnection *cnc)
GdaMetaStore *store = NULL;
g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_lock (& cnc->priv->object_mutex);
-#else
- g_mutex_lock (cnc->priv->object_mutex);
-#endif
if (!cnc->priv->meta_store) {
ThreadConnectionData *cdata = NULL;
if (cnc->priv->is_thread_wrapper) {
@@ -6604,11 +6468,7 @@ gda_connection_get_meta_store (GdaConnection *cnc)
}
}
store = cnc->priv->meta_store;
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_unlock (& cnc->priv->object_mutex);
-#else
- g_mutex_unlock (cnc->priv->object_mutex);
-#endif
return store;
}
@@ -6633,56 +6493,29 @@ gda_connection_lock (GdaLockable *lockable)
{
GdaConnection *cnc = (GdaConnection *) lockable;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (& cnc->priv->rmutex);
-#else
- gda_mutex_lock (cnc->priv->mutex);
-#endif
if (cnc->priv->unique_possible_thread &&
(cnc->priv->unique_possible_thread != g_thread_self ())) {
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (& cnc->priv->rmutex);
g_mutex_lock (& cnc->priv->object_mutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
- g_mutex_lock (cnc->priv->object_mutex);
-#endif
-
-#if GLIB_CHECK_VERSION(2,31,7)
-#else
- if (!cnc->priv->unique_possible_cond)
- cnc->priv->unique_possible_cond = g_cond_new ();
-#endif
while (1) {
if (cnc->priv->unique_possible_thread &&
(cnc->priv->unique_possible_thread != g_thread_self ())) {
#ifdef GDA_DEBUG_CNC_LOCK
g_print ("Wainting th %p, now %p (cond %p, mutex%p)\n", g_thread_self(),
- cnc->priv->unique_possible_thread, cnc->priv->unique_possible_cond,
+ cnc->priv->unique_possible_thread, &cnc->priv->unique_possible_cond,
cnc->priv->object_mutex);
#endif
-#if GLIB_CHECK_VERSION(2,31,7)
gint64 end_time;
end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND;
while (! g_cond_wait_until (& cnc->priv->unique_possible_cond,
& cnc->priv->object_mutex, end_time));
-#else
- g_cond_wait (cnc->priv->unique_possible_cond,
- cnc->priv->object_mutex);
-#endif
}
-#if GLIB_CHECK_VERSION(2,31,7)
else if (g_rec_mutex_trylock (& cnc->priv->rmutex)) {
g_mutex_unlock (& cnc->priv->object_mutex);
break;
}
-#else
- else if (gda_mutex_trylock (cnc->priv->mutex)) {
- g_mutex_unlock (cnc->priv->object_mutex);
- break;
- }
-#endif
}
}
}
@@ -6699,19 +6532,11 @@ gda_connection_trylock (GdaLockable *lockable)
gboolean retval;
GdaConnection *cnc = (GdaConnection *) lockable;
-#if GLIB_CHECK_VERSION(2,31,7)
retval = g_rec_mutex_trylock (& cnc->priv->rmutex);
-#else
- retval = gda_mutex_trylock (cnc->priv->mutex);
-#endif
if (retval && cnc->priv->unique_possible_thread &&
(cnc->priv->unique_possible_thread != g_thread_self ())) {
retval = FALSE;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (& cnc->priv->rmutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
-#endif
}
return retval;
}
@@ -6724,11 +6549,7 @@ static void
gda_connection_unlock (GdaLockable *lockable)
{
GdaConnection *cnc = (GdaConnection *) lockable;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (& cnc->priv->rmutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
-#endif
}
static gchar *
@@ -7175,19 +6996,11 @@ _gda_thread_connection_data_free (ThreadConnectionData *cdata)
void
_gda_thread_connection_set_data (GdaConnection *cnc, ThreadConnectionData *cdata)
{
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (& cnc->priv->rmutex);
-#else
- gda_mutex_lock (cnc->priv->mutex);
-#endif
if (cnc->priv->th_data)
_gda_thread_connection_data_free (cnc->priv->th_data);
cnc->priv->th_data = cdata;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (& cnc->priv->rmutex);
-#else
- gda_mutex_unlock (cnc->priv->mutex);
-#endif
}
ThreadConnectionData *
diff --git a/libgda/gda-data-handler.c b/libgda/gda-data-handler.c
index 784318c..d7c6231 100644
--- a/libgda/gda-data-handler.c
+++ b/libgda/gda-data-handler.c
@@ -28,15 +28,9 @@
#include "handlers/gda-handler-time.h"
#include "handlers/gda-handler-type.h"
-#if GLIB_CHECK_VERSION(2,31,7)
static GRecMutex init_rmutex;
#define MUTEX_LOCK() g_rec_mutex_lock(&init_rmutex)
#define MUTEX_UNLOCK() g_rec_mutex_unlock(&init_rmutex)
-#else
-static GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
-#define MUTEX_LOCK() g_static_rec_mutex_lock(&init_mutex)
-#define MUTEX_UNLOCK() g_static_rec_mutex_unlock(&init_mutex)
-#endif
static void gda_data_handler_iface_init (gpointer g_class);
GType
diff --git a/libgda/gda-data-model.c b/libgda/gda-data-model.c
index d64c150..2c2f334 100644
--- a/libgda/gda-data-model.c
+++ b/libgda/gda-data-model.c
@@ -11,7 +11,7 @@
* Copyright (C) 2005 - 2009 Bas Driessen <bas driessen xobas com>
* Copyright (C) 2005 Dan Winship <danw src gnome org>
* Copyright (C) 2005 Stanislav Brabec <sbrabec suse de>
- * Copyright (C) 2005 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2005 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2006 - 2011 Murray Cumming <murrayc murrayc com>
* Copyright (C) 2007 Leonardo Boshell <lb kmc com co>
* Copyright (C) 2008 Phil Longstaff <plongstaff rogers com>
@@ -60,15 +60,9 @@
#include "csv.h"
extern gchar *gda_lang_locale;
-#if GLIB_CHECK_VERSION(2,31,7)
static GRecMutex init_rmutex;
#define MUTEX_LOCK() g_rec_mutex_lock(&init_rmutex)
#define MUTEX_UNLOCK() g_rec_mutex_unlock(&init_rmutex)
-#else
-static GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
-#define MUTEX_LOCK() g_static_rec_mutex_lock(&init_mutex)
-#define MUTEX_UNLOCK() g_static_rec_mutex_unlock(&init_mutex)
-#endif
static void gda_data_model_class_init (gpointer g_class);
static xmlNodePtr gda_data_model_to_xml_node (GdaDataModel *model, const gint *cols, gint nb_cols,
diff --git a/libgda/gda-data-pivot.c b/libgda/gda-data-pivot.c
index 9a97a2b..a5a3a05 100644
--- a/libgda/gda-data-pivot.c
+++ b/libgda/gda-data-pivot.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2011 Murray Cumming <murrayc murrayc com>
- * Copyright (C) 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2011 - 2013 Vivien Malerba <malerba gnome-db org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -862,41 +862,21 @@ aggregate_handle_double (CellData *cdata, gdouble val)
static gboolean
aggregate_handle_char (CellData *cdata,
-#if GLIB_CHECK_VERSION(2,31,7)
gint8 val
-#else
- gchar val
-#endif
)
{
if (cdata->data_value) {
-#if GLIB_CHECK_VERSION(2,31,7)
gint8 eval = 0;
-#else
- gchar eval = 0;
-#endif
if (G_VALUE_TYPE (cdata->data_value) == G_TYPE_CHAR)
-#if GLIB_CHECK_VERSION(2,31,7)
eval = g_value_get_schar (cdata->data_value);
-#else
- eval = g_value_get_char (cdata->data_value);
-#endif
switch (cdata->aggregate) {
case GDA_DATA_PIVOT_MIN:
if (eval > val)
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (cdata->data_value, val);
-#else
- g_value_set_char (cdata->data_value, val);
-#endif
break;
case GDA_DATA_PIVOT_MAX:
if (eval < val)
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (cdata->data_value, val);
-#else
- g_value_set_char (cdata->data_value, val);
-#endif
break;
case GDA_DATA_PIVOT_SUM: {
gint tmp;
@@ -906,11 +886,7 @@ aggregate_handle_char (CellData *cdata,
GDA_DATA_PIVOT_ERROR, GDA_DATA_PIVOT_OVERFLOW_ERROR,
"%s", _("Integer overflow"));
else
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (cdata->data_value, (gint8) tmp);
-#else
- g_value_set_char (cdata->data_value, (gchar) tmp);
-#endif
break;
}
case GDA_DATA_PIVOT_AVG: {
@@ -936,11 +912,7 @@ aggregate_handle_char (CellData *cdata,
case GDA_DATA_PIVOT_MAX:
case GDA_DATA_PIVOT_SUM:
cdata->data_value = gda_value_new (G_TYPE_CHAR);
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (cdata->data_value, val);
-#else
- g_value_set_char (cdata->data_value, val);
-#endif
break;
case GDA_DATA_PIVOT_AVG:
cdata->data_value = gda_value_new (G_TYPE_INT64);
@@ -1197,11 +1169,7 @@ aggregate_handle_new_value (CellData *cdata, const GValue *new_value)
else if (cdata->gtype == G_TYPE_DOUBLE)
return aggregate_handle_double (cdata, g_value_get_double (new_value));
else if (cdata->gtype == G_TYPE_CHAR)
-#if GLIB_CHECK_VERSION(2,31,7)
return aggregate_handle_char (cdata, g_value_get_schar (new_value));
-#else
- return aggregate_handle_char (cdata, g_value_get_char (new_value));
-#endif
else if (cdata->gtype == G_TYPE_UCHAR)
return aggregate_handle_uchar (cdata, g_value_get_uchar (new_value));
else if (cdata->gtype == GDA_TYPE_SHORT)
diff --git a/libgda/gda-holder.c b/libgda/gda-holder.c
index 345061f..1a3a2f7 100644
--- a/libgda/gda-holder.c
+++ b/libgda/gda-holder.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2008 Massimo Cora <maxcvs email it>
* Copyright (C) 2008 - 2011 Murray Cumming <murrayc murrayc com>
- * Copyright (C) 2008 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2008 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2009 Bas Driessen <bas driessen xobas com>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2010 Jonh Wendell <jwendell gnome org>
@@ -515,11 +515,7 @@ gda_holder_new_inline (GType type, const gchar *id, ...)
else if (type == GDA_TYPE_USHORT)
gda_value_set_ushort (value, va_arg (ap, guint));
else if (type == G_TYPE_CHAR)
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (value, va_arg (ap, int));
-#else
- g_value_set_char (value, va_arg (ap, int));
-#endif
else if (type == G_TYPE_UCHAR)
g_value_set_uchar (value, va_arg (ap, guint));
else if (type == G_TYPE_FLOAT)
diff --git a/libgda/gda-init.c b/libgda/gda-init.c
index d2b796c..16d33f7 100644
--- a/libgda/gda-init.c
+++ b/libgda/gda-init.c
@@ -113,9 +113,7 @@ gda_locale_changed (void)
/**
* gda_init:
*
- * Initializes the GDA library, must be called prior to any Libgda usage. Note that unless the
- * LIBGDA_NO_THREADS environment variable is set (to any value), the GLib thread system will
- * be initialized as well if not yet initialized.
+ * Initializes the GDA library, must be called prior to any Libgda usage.
*
* Please note that if you call setlocale() to modify the current locale, you should also
* call gda_locale_changed() before using Libgda again.
@@ -141,20 +139,6 @@ gda_init (void)
g_free (file);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#if GLIB_CHECK_VERSION(2,31,7)
- /* threading cannot ne disabled */
-#else
- /* Threading support if possible */
- if (!getenv ("LIBGDA_NO_THREADS")) { /* Flawfinder: ignore */
-#ifdef G_THREADS_ENABLED
-#ifndef G_THREADS_IMPL_NONE
- if (! g_thread_supported ())
- g_thread_init (NULL);
-#endif
-#endif
- }
-#endif
-
#if GLIB_CHECK_VERSION(2,36,0)
#else
g_type_init ();
diff --git a/libgda/gda-lockable.c b/libgda/gda-lockable.c
index 38e298c..4ed14cb 100644
--- a/libgda/gda-lockable.c
+++ b/libgda/gda-lockable.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2008 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2010 David King <davidk openismus com>
*
* This library is free software; you can redistribute it and/or
@@ -20,15 +20,9 @@
#include <libgda/gda-lockable.h>
-#if GLIB_CHECK_VERSION(2,31,7)
static GRecMutex init_rmutex;
#define MUTEX_LOCK() g_rec_mutex_lock(&init_rmutex)
#define MUTEX_UNLOCK() g_rec_mutex_unlock(&init_rmutex)
-#else
-static GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
-#define MUTEX_LOCK() g_static_rec_mutex_lock(&init_mutex)
-#define MUTEX_UNLOCK() g_static_rec_mutex_unlock(&init_mutex)
-#endif
static void gda_lockable_class_init (gpointer g_class);
GType
diff --git a/libgda/gda-log.c b/libgda/gda-log.c
index 73c4423..e51de86 100644
--- a/libgda/gda-log.c
+++ b/libgda/gda-log.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2000 Reinhard Müller <reinhard src gnome org>
* Copyright (C) 2000 - 2003 Rodrigo Moya <rodrigo gnome-db org>
- * Copyright (C) 2001 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2001 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2002 - 2003 Gonzalo Paniagua Javier <gonzalo gnome-db org>
* Copyright (C) 2003 Laurent Sansonetti <laurent datarescue be>
* Copyright (C) 2003 Paisa Seeluangsawat <paisa users sf net>
@@ -36,15 +36,9 @@
#include <glib/gi18n-lib.h>
#include <libgda/gda-log.h>
-#if GLIB_CHECK_VERSION(2,31,7)
static GRecMutex gda_rmutex;
#define GDA_LOG_LOCK() g_rec_mutex_lock(&gda_rmutex)
#define GDA_LOG_UNLOCK() g_rec_mutex_unlock(&gda_rmutex)
-#else
-static GStaticRecMutex gda_mutex = G_STATIC_REC_MUTEX_INIT;
-#define GDA_LOG_LOCK() g_static_rec_mutex_lock(&gda_mutex)
-#define GDA_LOG_UNLOCK() g_static_rec_mutex_unlock(&gda_mutex)
-#endif
static gboolean log_enabled = TRUE;
static gboolean log_opened = FALSE;
diff --git a/libgda/gda-meta-store.c b/libgda/gda-meta-store.c
index d16c4fa..456aaa1 100644
--- a/libgda/gda-meta-store.c
+++ b/libgda/gda-meta-store.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2008 - 2009 Bas Driessen <bas driessen xobas com>
* Copyright (C) 2008 - 2011 Murray Cumming <murrayc murrayc com>
- * Copyright (C) 2008 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2008 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2010 Jonh Wendell <jwendell gnome org>
* Copyright (C) 2011 - 2012 Daniel Espinosa <despinosa src gnome org>
@@ -301,15 +301,9 @@ static void gda_meta_store_get_property (GObject *object,
static gboolean initialize_cnc_struct (GdaMetaStore *store, GError **error);
static void gda_meta_store_change_free (GdaMetaStoreChange *change);
-#if GLIB_CHECK_VERSION(2,31,7)
static GRecMutex init_rmutex;
#define MUTEX_LOCK() g_rec_mutex_lock(&init_rmutex)
#define MUTEX_UNLOCK() g_rec_mutex_unlock(&init_rmutex)
-#else
-static GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
-#define MUTEX_LOCK() g_static_rec_mutex_lock(&init_mutex)
-#define MUTEX_UNLOCK() g_static_rec_mutex_unlock(&init_mutex)
-#endif
/* simple predefined statements */
enum {
diff --git a/libgda/gda-mutex.c b/libgda/gda-mutex.c
index 9d9cccc..d735b10 100644
--- a/libgda/gda-mutex.c
+++ b/libgda/gda-mutex.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2008 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2010 Jonh Wendell <jwendell gnome org>
*
* This library is free software; you can redistribute it and/or
@@ -20,8 +20,6 @@
#include <libgda/gda-mutex.h>
-#if GLIB_CHECK_VERSION(2,31,7)
-
/**
* gda_mutex_new: (skip)
*
@@ -126,392 +124,3 @@ gda_mutex_dump_usage (GdaMutex *mutex, FILE *stream)
g_fprintf (stream, "%s", "Nothing to debug, GdaMutex is a GRecMutex.");
}
#endif
-
-
-#else /* GLIB_CHECK_VERSION */
-
-#ifdef GDA_DEBUG_MUTEX
-#define FRAMES_SIZE 10
-#include <glib/gprintf.h>
-#include <execinfo.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
-
-enum MutexRecStatus {
- UNKNOWN,
- RECURSIVE,
- NON_RECURSIVE,
- NON_SUPPORTED
-};
-
-static enum MutexRecStatus impl_status = UNKNOWN;
-
-#ifdef GDA_DEBUG_MUTEX
-static GMutex debug_mutex;
-
-typedef enum {
- USAGE_LOCK,
- USAGE_UNLOCK,
-} GdaMutexUsageType;
-
-typedef struct {
- GThread *thread;
- GdaMutexUsageType usage;
- gchar **frames; /* array terminated by a NULL */
-} GdaMutexUsage;
-#endif
-
-struct _GdaMutex {
- GMutex *mutex; /* internal mutex to access the structure's data */
- GCond *cond; /* condition to lock on */
- GThread *owner; /* current owner of the mutex, or NULL if not owned */
- short depth;
-#ifdef GDA_DEBUG_MUTEX
- gboolean debug; /* set tu %TRUE to debug this mutex */
- GArray *usages; /* Array of GdaMutexUsage */
- gint nb_locked_unlocked;
-#endif
-};
-
-#ifdef GDA_DEBUG_MUTEX
-void
-gda_mutex_debug (GdaMutex *mutex, gboolean debug)
-{
- g_mutex_lock (&debug_mutex);
- mutex->debug = debug;
- g_mutex_unlock (&debug_mutex);
-}
-
-void
-gda_mutex_dump_usage (GdaMutex *mutex, FILE *stream)
-{
- guint i;
- FILE *st;
- if (stream)
- st = stream;
- else
- st = stdout;
-
- g_mutex_lock (&debug_mutex);
- if (mutex->debug) {
- g_fprintf (st, "%s (mutex=>%p): locked&unlocked %d times\n", __FUNCTION__, mutex,
- mutex->nb_locked_unlocked);
- for (i = mutex->usages->len; i > 0; i--) {
- GdaMutexUsage *usage;
- gint j;
- usage = &g_array_index (mutex->usages, GdaMutexUsage, i - 1);
- g_fprintf (st, "%d\t------ BEGIN GdaMutex %p usage\n", i - 1, mutex);
- g_fprintf (st, "\t%s, thread %p\n",
- usage->usage == USAGE_LOCK ? "LOCK" : "UNLOCK",
- usage->thread);
- for (j = 0; usage->frames[j]; j++)
- g_fprintf (st, "\t%s\n", usage->frames[j]);
- g_fprintf (st, "\t------ END GdaMutex %p usage\n", mutex);
- }
- }
- g_mutex_unlock (&debug_mutex);
-}
-
-static void
-gda_mutex_usage_locked (GdaMutex *mutex)
-{
- g_mutex_lock (&debug_mutex);
-
- if (mutex->debug) {
- GdaMutexUsage usage;
- usage.thread = g_thread_self ();
- usage.usage = USAGE_LOCK;
-
- void *array[FRAMES_SIZE];
- size_t size;
- char **strings;
- size_t i;
-
- size = backtrace (array, 10);
- strings = backtrace_symbols (array, size);
- usage.frames = g_new (gchar *, size + 1);
- usage.frames[size] = NULL;
- for (i = 0; i < size; i++)
- usage.frames[i] = g_strdup (strings[i]);
- free (strings);
-
- g_array_prepend_val (mutex->usages, usage);
- }
- g_mutex_unlock (&debug_mutex);
- gda_mutex_dump_usage (mutex, NULL);
-}
-
-static void
-gda_mutex_usage_unlocked (GdaMutex *mutex)
-{
- g_mutex_lock (&debug_mutex);
- if (mutex->debug) {
- void *array[FRAMES_SIZE];
- size_t size;
- char **strings;
- size_t i;
- gboolean matched = FALSE;
-
- size = backtrace (array, 10);
- strings = backtrace_symbols (array, size);
-
- if (mutex->usages->len > 0) {
- GdaMutexUsage *last;
- last = &g_array_index (mutex->usages, GdaMutexUsage, 0);
- if ((size > 3) &&
- (last->usage == USAGE_LOCK) &&
- (last->thread == g_thread_self ())) {
- for (i = 3; i < size; i++) {
- if (! last->frames[i] || (last->frames[i] &&
- strcmp (last->frames[i], strings[i])))
- break;
- }
- if ((i == size) && ! last->frames[i]) {
- /* same stack => delete @last */
- g_strfreev (last->frames);
- g_array_remove_index (mutex->usages, 0);
- matched = TRUE;
- mutex->nb_locked_unlocked++;
- }
- }
- }
-
- if (! matched) {
- GdaMutexUsage usage;
- usage.thread = g_thread_self ();
- usage.usage = USAGE_UNLOCK;
-
- usage.frames = g_new (gchar *, size + 1);
- usage.frames[size] = NULL;
- for (i = 0; i < size; i++)
- usage.frames[i] = g_strdup (strings[i]);
-
- g_array_prepend_val (mutex->usages, usage);
- }
- free (strings);
- }
- g_mutex_unlock (&debug_mutex);
- gda_mutex_dump_usage (mutex, NULL);
-}
-
-#endif
-
-/**
- * gda_mutex_new: (skip)
- *
- * Creates a new #GdaMutex.
- *
- * Note: Unlike g_mutex_new(), this function will return %NULL if g_thread_init() has not been called yet.
- *
- * Returns: (transfer full): a new #GdaMutex
- */
-GdaMutex*
-gda_mutex_new ()
-{
- if (G_UNLIKELY (impl_status == UNKNOWN)) {
- static GMutex init_mutex;
-
- g_mutex_lock (&init_mutex);
- if (impl_status == UNKNOWN) {
- if (!g_thread_supported ())
- impl_status = NON_SUPPORTED;
- else {
- GMutex *m;
- m = g_mutex_new ();
- g_mutex_lock (m);
- if (g_mutex_trylock (m)) {
- impl_status = RECURSIVE;
- g_mutex_unlock (m);
- }
- else
- impl_status = NON_RECURSIVE;
- g_mutex_unlock (m);
- g_mutex_free (m);
-#ifdef GDA_DEBUG_NO
- g_message ("GMutex %s recursive\n", (impl_status == RECURSIVE) ? "is" :
"isn't");
-#endif
- }
- }
- g_mutex_unlock (&init_mutex);
- }
-
- if (impl_status == NON_SUPPORTED) {
- GdaMutex *m;
- m = g_new0 (GdaMutex, 1);
-#ifdef GDA_DEBUG_MUTEX
- m->usages = g_array_new (FALSE, FALSE, sizeof (GdaMutexUsage));
- m->debug = FALSE;
-#endif
- return m;
- }
- else {
- GdaMutex *m;
- m = g_new0 (GdaMutex, 1);
- m->mutex = g_mutex_new ();
- m->cond = g_cond_new ();
- m->owner = NULL;
- m->depth = 0;
-#ifdef GDA_DEBUG_MUTEX
- m->usages = g_array_new (FALSE, FALSE, sizeof (GdaMutexUsage));
- m->debug = FALSE;
-#endif
- return m;
- }
-}
-
-/**
- * gda_mutex_lock:
- * @mutex: a #GdaMutex
- *
- * Locks @mutex. If @mutex is already locked by another thread, the current thread will block until @mutex
is unlocked by the other thread.
- *
- * This function can be used even if g_thread_init() has not yet been called, and, in that case, will do
nothing.
- *
- * Note: unlike g_mutex_lock(), the #GdaMutex is recursive, which means a thread can lock it several times
(and has
- * to unlock it as many times to actually unlock it).
- */
-void
-gda_mutex_lock (GdaMutex *mutex)
-{
- if (impl_status == RECURSIVE)
- g_mutex_lock (mutex->mutex);
- else if (impl_status == NON_SUPPORTED)
- return;
- else {
- GThread *th = g_thread_self ();
- g_mutex_lock (mutex->mutex);
- while (1) {
- if (!mutex->owner) {
- mutex->owner = th;
- mutex->depth = 1;
- break;
- }
- else if (mutex->owner == th) {
- mutex->depth++;
- break;
- }
- else {
- g_cond_wait (mutex->cond, mutex->mutex);
- }
- }
- g_mutex_unlock (mutex->mutex);
- }
-#ifdef GDA_DEBUG_MUTEX
- gda_mutex_usage_locked (mutex);
-#endif
-}
-
-/**
- * gda_mutex_trylock:
- * @mutex: a #GdaMutex
- *
- * Tries to lock @mutex. If @mutex is already locked by another thread, it immediately returns FALSE.
- * Otherwise it locks @mutex and returns TRUE
- *
- * This function can be used even if g_thread_init() has not yet been called, and, in that case, will
immediately return TRUE.
- *
- * Note: Unlike g_mutex_trylock(), the #GdaMutex is recursive, which means a thread can lock it several
times (and has
- * to unlock it as many times to actually unlock it)
- *
- * Returns: TRUE, if @mutex could be locked.
- */
-gboolean
-gda_mutex_trylock (GdaMutex *mutex)
-{
- if (impl_status == RECURSIVE) {
-#ifdef GDA_DEBUG_MUTEX
- gboolean retval;
- retval = g_mutex_trylock (mutex->mutex);
- if (retval)
- gda_mutex_usage_locked (mutex);
- return retval;
-#else
- return g_mutex_trylock (mutex->mutex);
-#endif
- }
- else if (impl_status == NON_SUPPORTED)
- return TRUE;
- else {
- GThread *th = g_thread_self ();
- gboolean retval;
- g_mutex_lock (mutex->mutex);
- if (!mutex->owner) {
- mutex->owner = th;
- mutex->depth = 1;
- retval = TRUE;
- }
- else if (mutex->owner == th) {
- mutex->depth++;
- retval = TRUE;
- }
- else
- retval = FALSE;
- g_mutex_unlock (mutex->mutex);
-#ifdef GDA_DEBUG_MUTEX
- if (retval)
- gda_mutex_usage_locked (mutex);
-#endif
- return retval;
- }
-}
-
-/**
- * gda_mutex_unlock:
- * @mutex: a #GdaMutex
- *
- * Unlocks @mutex. If another thread is blocked in a gda_mutex_lock() call for @mutex, it wil
- * be woken and can lock @mutex itself.
- * This function can be used even if g_thread_init() has not yet been called, and, in that case, will do
nothing.
- */
-void
-gda_mutex_unlock (GdaMutex *mutex)
-{
-#ifdef GDA_DEBUG_MUTEX
- gda_mutex_usage_unlocked (mutex);
-#endif
- if (impl_status == RECURSIVE)
- g_mutex_unlock (mutex->mutex);
- else if (impl_status == NON_SUPPORTED)
- return;
- else {
- GThread *th = g_thread_self ();
- g_mutex_lock (mutex->mutex);
- g_assert (th == mutex->owner);
- mutex->depth--;
- if (mutex->depth == 0) {
- mutex->owner = NULL;
- g_cond_signal (mutex->cond);
- }
- g_mutex_unlock (mutex->mutex);
- }
-}
-
-/**
- * gda_mutex_free:
- * @mutex: (transfer full): a #GdaMutex
- *
- * Destroys @mutex.
- */
-void
-gda_mutex_free (GdaMutex *mutex)
-{
- g_assert (mutex);
- if (mutex->cond)
- g_cond_free (mutex->cond);
- mutex->cond = NULL;
- if (mutex->mutex)
- g_mutex_free (mutex->mutex);
- mutex->mutex = NULL;
-#ifdef GDA_DEBUG_MUTEX
- guint i;
- for (i = 0; i < mutex->usages->len; i++) {
- GdaMutexUsage *usage;
- usage = &g_array_index (mutex->usages, GdaMutexUsage, i);
- g_strfreev (usage->frames);
- }
-#endif
- g_free (mutex);
-}
-
-#endif /* GLIB_CHECK_VERSION */
diff --git a/libgda/gda-mutex.h b/libgda/gda-mutex.h
index 5659060..f2e684a 100644
--- a/libgda/gda-mutex.h
+++ b/libgda/gda-mutex.h
@@ -2,7 +2,7 @@
* Copyright (C) 2000 Reinhard Müller <reinhard src gnome org>
* Copyright (C) 2000 - 2002 Rodrigo Moya <rodrigo gnome-db org>
* Copyright (C) 2001 Carlos Perell� Mar�n <carlos gnome-db org>
- * Copyright (C) 2001 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2001 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2002 Gonzalo Paniagua Javier <gonzalo src gnome org>
*
* This library is free software; you can redistribute it and/or
@@ -28,11 +28,7 @@
G_BEGIN_DECLS
-#if GLIB_CHECK_VERSION(2,31,7)
typedef GRecMutex GdaMutex;
-#else
-typedef struct _GdaMutex GdaMutex;
-#endif
/**
* SECTION:gda-mutex
diff --git a/libgda/gda-set.c b/libgda/gda-set.c
index 7166d0e..950a197 100644
--- a/libgda/gda-set.c
+++ b/libgda/gda-set.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 - 2011 Murray Cumming <murrayc murrayc com>
- * Copyright (C) 2008 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2008 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2009 Bas Driessen <bas driessen xobas com>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2013 Daniel Espinosa <esodan gmail com>
@@ -1150,11 +1150,7 @@ gda_set_new_inline (gint nb, ...)
else if (type == GDA_TYPE_USHORT)
gda_value_set_ushort (value, va_arg (ap, guint));
else if (type == G_TYPE_CHAR)
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (value, va_arg (ap, gint));
-#else
- g_value_set_char (value, va_arg (ap, int));
-#endif
else if (type == G_TYPE_UCHAR)
g_value_set_uchar (value, va_arg (ap, guint));
else if (type == G_TYPE_FLOAT)
@@ -1258,11 +1254,7 @@ gda_set_set_holder_value (GdaSet *set, GError **error, const gchar *holder_id, .
else if (type == GDA_TYPE_USHORT)
gda_value_set_ushort (value, va_arg (ap, guint));
else if (type == G_TYPE_CHAR)
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (value, va_arg (ap, gint));
-#else
- g_value_set_char (value, va_arg (ap, int));
-#endif
else if (type == G_TYPE_UCHAR)
g_value_set_uchar (value, va_arg (ap, guint));
else if (type == G_TYPE_FLOAT)
diff --git a/libgda/gda-sql-builder.c b/libgda/gda-sql-builder.c
index a10ee78..40434e1 100644
--- a/libgda/gda-sql-builder.c
+++ b/libgda/gda-sql-builder.c
@@ -2,7 +2,7 @@
* Copyright (C) 2009 Bas Driessen <bas driessen xobas com>
* Copyright (C) 2009 Johannes Schmid <jhs gnome org>
* Copyright (C) 2009 - 2011 Murray Cumming <murrayc murrayc com>
- * Copyright (C) 2009 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2010 Jonh Wendell <jwendell gnome org>
* Copyright (C) 2011 Daniel Espinosa <despinosa src gnome org>
@@ -551,11 +551,7 @@ create_typed_value (GType type, va_list *ap)
else if (type == GDA_TYPE_USHORT)
gda_value_set_ushort ((v = gda_value_new (GDA_TYPE_USHORT)), va_arg (*ap, guint));
else if (type == G_TYPE_CHAR)
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar ((v = gda_value_new (G_TYPE_CHAR)), va_arg (*ap, gint));
-#else
- g_value_set_char ((v = gda_value_new (G_TYPE_CHAR)), va_arg (*ap, gint));
-#endif
else if (type == G_TYPE_UCHAR)
g_value_set_uchar ((v = gda_value_new (G_TYPE_UCHAR)), va_arg (*ap, guint));
else if (type == G_TYPE_FLOAT)
diff --git a/libgda/gda-value.c b/libgda/gda-value.c
index cf4b5c6..418faaf 100644
--- a/libgda/gda-value.c
+++ b/libgda/gda-value.c
@@ -2,7 +2,7 @@
* Copyright (C) 2001 - 2003 Rodrigo Moya <rodrigo gnome-db org>
* Copyright (C) 2002 - 2003 Gonzalo Paniagua Javier <gonzalo gnome-db org>
* Copyright (C) 2002 Holger Thon <holger thon gnome-db org>
- * Copyright (C) 2002 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2002 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2002 Zbigniew Chyla <cyba gnome pl>
* Copyright (C) 2003 Akira TAGOH <tagoh gnome-db org>
* Copyright (C) 2003 Danilo Schoeneberg <dschoene src gnome org>
@@ -172,11 +172,7 @@ set_from_string (GValue *value, const gchar *as_string)
else if (type == G_TYPE_CHAR) {
lvalue = strtol (as_string, endptr, 10);
if (*as_string!=0 && **endptr==0) {
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar(value,(gint)lvalue);
-#else
- g_value_set_char(value,(gchar)lvalue);
-#endif
retval = TRUE;
}
}
@@ -2601,13 +2597,8 @@ gda_value_compare (const GValue *value1, const GValue *value2)
}
else if (type == G_TYPE_CHAR) {
-#if GLIB_CHECK_VERSION(2,31,7)
gint8 c1 = g_value_get_schar (value1);
gint8 c2 = g_value_get_schar (value2);
-#else
- gchar c1 = g_value_get_char (value1);
- gchar c2 = g_value_get_char (value2);
-#endif
return (c1 > c2) ? 1 : ((c1 == c2) ? 0 : -1);
}
diff --git a/libgda/handlers/gda-handler-numerical.c b/libgda/handlers/gda-handler-numerical.c
index 903a15a..3dd22ee 100644
--- a/libgda/handlers/gda-handler-numerical.c
+++ b/libgda/handlers/gda-handler-numerical.c
@@ -299,11 +299,7 @@ gda_handler_numerical_get_value_from_str (G_GNUC_UNUSED GdaDataHandler *iface, c
else if (type == G_TYPE_CHAR) {
if (!*endptr && (llint >= G_MININT8) && (llint <= G_MAXINT8)) {
value = g_value_init (g_new0 (GValue, 1), G_TYPE_CHAR);
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (value, (gchar) llint);
-#else
- g_value_set_char (value, (gint8) llint);
-#endif
}
}
else if (type == G_TYPE_UINT64) {
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index f31214c..e6cdf3c 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -8,7 +8,7 @@
* Copyright (C) 2004 J�rg Billeter <j bitron ch>
* Copyright (C) 2004 Nikolai Weibull <ruby-gnome2-devel-en-list pcppopper org>
* Copyright (C) 2005 Denis Fortin <denis fortin free fr>
- * Copyright (C) 2005 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2005 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2005 �lvaro Pe�a <alvaropg telefonica net>
* Copyright (C) 2008 - 2009 Bas Driessen <bas driessen xobas com>
* Copyright (C) 2008 - 2011 Murray Cumming <murrayc murrayc com>
@@ -3214,11 +3214,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
else if (G_VALUE_TYPE (value) == GDA_TYPE_USHORT)
SQLITE3_CALL (sqlite3_bind_int) (ps->sqlite_stmt, i, gda_value_get_ushort (value));
else if (G_VALUE_TYPE (value) == G_TYPE_CHAR)
-#if GLIB_CHECK_VERSION(2,31,7)
SQLITE3_CALL (sqlite3_bind_int) (ps->sqlite_stmt, i, g_value_get_schar (value));
-#else
- SQLITE3_CALL (sqlite3_bind_int) (ps->sqlite_stmt, i, g_value_get_char (value));
-#endif
else if (G_VALUE_TYPE (value) == G_TYPE_UCHAR)
SQLITE3_CALL (sqlite3_bind_int) (ps->sqlite_stmt, i, g_value_get_uchar (value));
else if (G_VALUE_TYPE (value) == GDA_TYPE_BLOB) {
diff --git a/libgda/sqlite/gda-sqlite-recordset.c b/libgda/sqlite/gda-sqlite-recordset.c
index 72b0889..6ef4914 100644
--- a/libgda/sqlite/gda-sqlite-recordset.c
+++ b/libgda/sqlite/gda-sqlite-recordset.c
@@ -3,7 +3,7 @@
* Copyright (C) 2002 - 2003 Gonzalo Paniagua Javier <gonzalo src gnome org>
* Copyright (C) 2002 - 2005 Rodrigo Moya <rodrigo gnome-db org>
* Copyright (C) 2005 Denis Fortin <denis fortin free fr>
- * Copyright (C) 2005 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2005 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2005 �lvaro Pe�a <alvaropg telefonica net>
* Copyright (C) 2006 - 2008 Murray Cumming <murrayc murrayc com>
* Copyright (C) 2007 Armin Burgmeier <arminb src gnome org>
@@ -579,11 +579,7 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
gda_row_invalidate_value_e (prow, value, lerror);
}
else
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (value, (gchar) i);
-#else
- g_value_set_char (value, (gchar) i);
-#endif
}
else if (type == G_TYPE_UCHAR) {
gint64 i;
diff --git a/libgda/sqlite/virtual/gda-vconnection-data-model.c
b/libgda/sqlite/virtual/gda-vconnection-data-model.c
index 822a273..c6f522e 100644
--- a/libgda/sqlite/virtual/gda-vconnection-data-model.c
+++ b/libgda/sqlite/virtual/gda-vconnection-data-model.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2007 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2008 - 2011 Murray Cumming <murrayc murrayc com>
* Copyright (C) 2009 Bas Driessen <bas driessen xobas com>
* Copyright (C) 2010 David King <davidk openismus com>
@@ -32,11 +32,7 @@
struct _GdaVconnectionDataModelPrivate {
GSList *table_data_list; /* list of GdaVConnectionTableData structures */
-#if GLIB_CHECK_VERSION(2,32,0)
GMutex lock_context;
-#else
- GMutex *lock_context;
-#endif
GdaStatement *executed_stmt;
};
@@ -143,11 +139,7 @@ gda_vconnection_data_model_init (GdaVconnectionDataModel *cnc, G_GNUC_UNUSED Gda
{
cnc->priv = g_new (GdaVconnectionDataModelPrivate, 1);
cnc->priv->table_data_list = NULL;
-#if GLIB_CHECK_VERSION(2,32,0)
g_mutex_init (& (cnc->priv->lock_context));
-#else
- cnc->priv->lock_context = g_mutex_new ();
-#endif
g_object_set (G_OBJECT (cnc), "cnc-string", "_IS_VIRTUAL=TRUE", NULL);
}
@@ -168,11 +160,7 @@ gda_vconnection_data_model_dispose (GObject *object)
}
gda_connection_close_no_warning ((GdaConnection *) cnc);
-#if GLIB_CHECK_VERSION(2,32,0)
g_mutex_clear (& (cnc->priv->lock_context));
-#else
- g_mutex_free (cnc->priv->lock_context);
-#endif
g_free (cnc->priv);
cnc->priv = NULL;
}
@@ -645,21 +633,13 @@ _gda_vconnection_set_working_obj (GdaVconnectionDataModel *cnc, GObject *obj)
{
GSList *list;
if (obj) {
-#if GLIB_CHECK_VERSION(2,32,0)
g_mutex_lock (& (cnc->priv->lock_context));
-#else
- g_mutex_lock (cnc->priv->lock_context);
-#endif
for (list = cnc->priv->table_data_list; list; list = list->next) {
GdaVConnectionTableData *td = (GdaVConnectionTableData*) list->data;
VContext *vc = NULL;
g_assert (!td->context.current_vcontext);
-#if GLIB_CHECK_VERSION(2,32,0)
td->context.mutex = &(cnc->priv->lock_context);
-#else
- td->context.mutex = cnc->priv->lock_context;
-#endif
if (! td->context.hash)
td->context.hash = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify)
vcontext_free);
@@ -688,11 +668,7 @@ _gda_vconnection_set_working_obj (GdaVconnectionDataModel *cnc, GObject *obj)
* an exception already occurred */
td->context.current_vcontext = NULL;
}
-#if GLIB_CHECK_VERSION(2,32,0)
g_mutex_unlock (& (cnc->priv->lock_context));
-#else
- g_mutex_unlock (cnc->priv->lock_context);
-#endif
}
}
diff --git a/libgda/thread-wrapper/gda-thread-wrapper.c b/libgda/thread-wrapper/gda-thread-wrapper.c
index f3298cd..3895361 100644
--- a/libgda/thread-wrapper/gda-thread-wrapper.c
+++ b/libgda/thread-wrapper/gda-thread-wrapper.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 Bas Driessen <bas driessen xobas com>
- * Copyright (C) 2009 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2010 Jonh Wendell <jwendell gnome org>
*
@@ -40,11 +40,7 @@
* by the worker thread. It is used to avoid creating signal data for threads for which
* no job is being performed
*/
-#if GLIB_CHECK_VERSION(2,31,7)
GPrivate worker_thread_current_queue;
-#else
-GStaticPrivate worker_thread_current_queue = G_STATIC_PRIVATE_INIT;
-#endif
typedef struct _ThreadData ThreadData;
typedef struct _Job Job;
@@ -52,11 +48,7 @@ typedef struct _SignalSpec SignalSpec;
typedef struct _Pipe Pipe;
struct _GdaThreadWrapperPrivate {
-#if GLIB_CHECK_VERSION(2,31,7)
GRecMutex rmutex;
-#else
- GdaMutex *mutex;
-#endif
guint next_job_id;
GThread *worker_thread;
GAsyncQueue *to_worker_thread;
@@ -76,21 +68,12 @@ struct _Pipe {
int fds[2]; /* [0] for reading and [1] for writing */
GIOChannel *ioc;
-#if GLIB_CHECK_VERSION(2,31,7)
- GMutex mutex;
-#else
- GMutex *mutex; /* locks @ref_count */
-#endif
+ GMutex mutex; /* locks @ref_count */
guint ref_count;
};
-#if GLIB_CHECK_VERSION(2,31,7)
#define pipe_lock(x) g_mutex_lock(& (((Pipe*)x)->mutex))
#define pipe_unlock(x) g_mutex_unlock(& (((Pipe*)x)->mutex))
-#else
-#define pipe_lock(x) g_mutex_lock(((Pipe*)x)->mutex);
-#define pipe_unlock(x) g_mutex_unlock(((Pipe*)x)->mutex);
-#endif
static Pipe *
pipe_ref (Pipe *p)
@@ -117,11 +100,7 @@ pipe_unref (Pipe *p)
#endif
if (p->ref_count == 0) {
/* destroy @p */
-#if GLIB_CHECK_VERSION(2,31,7)
GMutex *m = &(p->mutex);
-#else
- GMutex *m = p->mutex;
-#endif
if (p->ioc)
g_io_channel_unref (p->ioc);
@@ -143,12 +122,7 @@ pipe_unref (Pipe *p)
g_free (p);
g_mutex_unlock (m);
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_clear (m);
-#else
- g_mutex_free (m);
-#endif
-
}
else
pipe_unlock (p);
@@ -164,11 +138,7 @@ pipe_new (void)
Pipe *p;
p = g_new0 (Pipe, 1);
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_init (&(p->mutex));
-#else
- p->mutex = g_mutex_new ();
-#endif
p->ref_count = 1;
p->thread = g_thread_self ();
#ifdef G_OS_WIN32
@@ -204,18 +174,10 @@ static Pipe *
get_pipe (GdaThreadWrapper *wrapper, GThread *thread)
{
Pipe *p = NULL;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
if (wrapper->priv->pipes_hash)
p = g_hash_table_lookup (wrapper->priv->pipes_hash, thread);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return p;
}
@@ -312,21 +274,12 @@ struct _SignalSpec {
GdaThreadWrapperCallback callback;
gpointer data;
-#if GLIB_CHECK_VERSION(2,31,7)
GMutex mutex;
-#else
- GMutex *mutex;
-#endif
guint ref_count;
};
-#if GLIB_CHECK_VERSION(2,31,7)
#define signal_spec_lock(x) g_mutex_lock(& (((SignalSpec*)x)->mutex))
#define signal_spec_unlock(x) g_mutex_unlock(& (((SignalSpec*)x)->mutex))
-#else
-#define signal_spec_lock(x) g_mutex_lock(((SignalSpec*)x)->mutex);
-#define signal_spec_unlock(x) g_mutex_unlock(((SignalSpec*)x)->mutex);
-#endif
/*
* call signal_spec_lock() before calling this function
@@ -337,11 +290,7 @@ signal_spec_unref (SignalSpec *sigspec)
sigspec->ref_count --;
if (sigspec->ref_count == 0) {
signal_spec_unlock (sigspec);
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_clear (&(sigspec->mutex));
-#else
- g_mutex_free (sigspec->mutex);
-#endif
if (sigspec->instance && (sigspec->signal_id > 0))
g_signal_handler_disconnect (sigspec->instance, sigspec->signal_id);
if (sigspec->reply_queue)
@@ -384,11 +333,7 @@ static ThreadData *
get_thread_data (GdaThreadWrapper *wrapper, GThread *thread)
{
ThreadData *td;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
td = g_hash_table_lookup (wrapper->priv->threads_hash, thread);
if (!td) {
Pipe *p;
@@ -402,11 +347,7 @@ get_thread_data (GdaThreadWrapper *wrapper, GThread *thread)
td->notif = pipe_ref (p);
g_hash_table_insert (wrapper->priv->threads_hash, thread, td);
}
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return td;
}
@@ -582,19 +523,11 @@ worker_thread_entry_point (GAsyncQueue *to_worker_thread)
Job *job;
/* pop next job and mark it as being processed */
-#if GLIB_CHECK_VERSION(2,31,7)
g_private_set (&worker_thread_current_queue, NULL);
-#else
- g_static_private_set (&worker_thread_current_queue, NULL, NULL);
-#endif
g_async_queue_lock (in);
job = g_async_queue_pop_unlocked (in);
job->processed = TRUE;
-#if GLIB_CHECK_VERSION(2,31,7)
g_private_set (&worker_thread_current_queue, job->reply_queue);
-#else
- g_static_private_set (&worker_thread_current_queue, job->reply_queue, NULL);
-#endif
g_async_queue_unlock (in);
if (job->cancelled) {
@@ -644,25 +577,15 @@ gda_thread_wrapper_init (GdaThreadWrapper *wrapper, G_GNUC_UNUSED GdaThreadWrapp
g_return_if_fail (GDA_IS_THREAD_WRAPPER (wrapper));
wrapper->priv = g_new0 (GdaThreadWrapperPrivate, 1);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_init (&(wrapper->priv->rmutex));
-#else
- wrapper->priv->mutex = gda_mutex_new ();
-#endif
wrapper->priv->next_job_id = 1;
wrapper->priv->threads_hash = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)
thread_data_free);
wrapper->priv->to_worker_thread = g_async_queue_new ();
-#if GLIB_CHECK_VERSION(2,31,7)
wrapper->priv->worker_thread = g_thread_new ("worker",
(GThreadFunc) worker_thread_entry_point,
g_async_queue_ref (wrapper->priv->to_worker_thread)); /*
inc. ref for sub thread usage */
-#else
- wrapper->priv->worker_thread = g_thread_create ((GThreadFunc) worker_thread_entry_point,
- g_async_queue_ref (wrapper->priv->to_worker_thread),
/* inc. ref for sub thread usage */
- FALSE, NULL);
-#endif
wrapper->priv->pipes_hash = NULL;
@@ -728,11 +651,7 @@ gda_thread_wrapper_dispose (GObject *object)
g_async_queue_unref (wrapper->priv->to_worker_thread);
wrapper->priv->worker_thread = NULL; /* side note: don't wait for sub thread to terminate */
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_clear (&(wrapper->priv->rmutex));
-#else
- gda_mutex_free (wrapper->priv->mutex);
-#endif
if (wrapper->priv->pipes_hash)
g_hash_table_destroy (wrapper->priv->pipes_hash);
@@ -879,11 +798,7 @@ gda_thread_wrapper_get_io_channel (GdaThreadWrapper *wrapper)
g_return_val_if_fail (wrapper->priv, NULL);
th = g_thread_self ();
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
p = get_pipe (wrapper, th);
if (!p) {
p = pipe_new ();
@@ -896,11 +811,7 @@ gda_thread_wrapper_get_io_channel (GdaThreadWrapper *wrapper)
g_hash_table_insert (wrapper->priv->pipes_hash, th, p);
}
}
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
if (p)
return p->ioc;
else
@@ -924,11 +835,7 @@ gda_thread_wrapper_unset_io_channel (GdaThreadWrapper *wrapper)
g_return_if_fail (GDA_IS_THREAD_WRAPPER (wrapper));
g_return_if_fail (wrapper->priv);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
th = g_thread_self ();
td = g_hash_table_lookup (wrapper->priv->threads_hash, th);
if (td) {
@@ -937,11 +844,7 @@ gda_thread_wrapper_unset_io_channel (GdaThreadWrapper *wrapper)
if (p)
clean_notifications (wrapper, td);
}
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
}
/**
@@ -987,17 +890,9 @@ gda_thread_wrapper_execute (GdaThreadWrapper *wrapper, GdaThreadWrapperFunc func
job->type = JOB_TYPE_EXECUTE;
job->processed = FALSE;
job->cancelled = FALSE;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
job->job_id = wrapper->priv->next_job_id++;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
job->func = func;
job->void_func = NULL;
job->arg = arg;
@@ -1079,17 +974,9 @@ gda_thread_wrapper_execute_void (GdaThreadWrapper *wrapper, GdaThreadWrapperVoid
job->type = JOB_TYPE_EXECUTE;
job->processed = FALSE;
job->cancelled = FALSE;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
job->job_id = wrapper->priv->next_job_id++;
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
job->func = NULL;
job->void_func = func;
job->arg = arg;
@@ -1151,20 +1038,12 @@ gda_thread_wrapper_cancel (GdaThreadWrapper *wrapper, guint id)
g_return_val_if_fail (GDA_IS_THREAD_WRAPPER (wrapper), FALSE);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
td = g_hash_table_lookup (wrapper->priv->threads_hash, g_thread_self());
if (!td) {
/* nothing to be done for this thread */
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return FALSE;
}
@@ -1188,11 +1067,7 @@ gda_thread_wrapper_cancel (GdaThreadWrapper *wrapper, guint id)
}
}
g_async_queue_unlock (wrapper->priv->to_worker_thread);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return retval;
}
@@ -1224,17 +1099,9 @@ gda_thread_wrapper_iterate (GdaThreadWrapper *wrapper, gboolean may_block)
g_return_if_fail (GDA_IS_THREAD_WRAPPER (wrapper));
g_return_if_fail (wrapper->priv);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
td = g_hash_table_lookup (wrapper->priv->threads_hash, g_thread_self());
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
if (!td) {
/* nothing to be done for this thread */
return;
@@ -1316,17 +1183,9 @@ gda_thread_wrapper_fetch_result (GdaThreadWrapper *wrapper, gboolean may_lock, g
g_return_val_if_fail (wrapper->priv, NULL);
g_return_val_if_fail (exp_id > 0, NULL);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
td = g_hash_table_lookup (wrapper->priv->threads_hash, g_thread_self());
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
if (!td) {
/* nothing to be done for this thread */
return NULL;
@@ -1346,17 +1205,9 @@ gda_thread_wrapper_fetch_result (GdaThreadWrapper *wrapper, gboolean may_lock, g
(g_async_queue_length (td->from_worker_thread) == 0) &&
!td->signals_list) {
/* remove this ThreadData */
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
g_hash_table_remove (wrapper->priv->threads_hash,
g_thread_self());
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
}
goto out;
}
@@ -1412,19 +1263,11 @@ gda_thread_wrapper_get_waiting_size (GdaThreadWrapper *wrapper)
g_return_val_if_fail (GDA_IS_THREAD_WRAPPER (wrapper), 0);
g_return_val_if_fail (wrapper->priv, 0);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
td = g_hash_table_lookup (wrapper->priv->threads_hash, g_thread_self());
if (!td) {
/* nothing to be done for this thread */
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return 0;
}
@@ -1435,11 +1278,7 @@ gda_thread_wrapper_get_waiting_size (GdaThreadWrapper *wrapper)
size++;
}
g_async_queue_unlock (wrapper->priv->to_worker_thread);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return size;
}
@@ -1462,15 +1301,9 @@ worker_thread_closure_marshal (GClosure *closure,
return;
/* check that the worker thread is working on a job for which job->reply_queue ==
sigspec->reply_queue */
-#if GLIB_CHECK_VERSION(2,31,7)
if (sigspec->private &&
g_private_get (&worker_thread_current_queue) != sigspec->reply_queue)
return;
-#else
- if (sigspec->private &&
- g_static_private_get (&worker_thread_current_queue) != sigspec->reply_queue)
- return;
-#endif
gsize i;
/*
@@ -1606,11 +1439,7 @@ gda_thread_wrapper_connect_raw (GdaThreadWrapper *wrapper,
g_return_val_if_fail (GDA_IS_THREAD_WRAPPER (wrapper), 0);
g_return_val_if_fail (wrapper->priv, 0);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
td = get_thread_data (wrapper, g_thread_self());
@@ -1636,11 +1465,7 @@ gda_thread_wrapper_connect_raw (GdaThreadWrapper *wrapper,
sigspec->instance = instance;
sigspec->callback = callback;
sigspec->data = data;
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_init (&(sigspec->mutex));
-#else
- sigspec->mutex = g_mutex_new ();
-#endif
sigspec->ref_count = 1;
GClosure *cl;
@@ -1653,11 +1478,7 @@ gda_thread_wrapper_connect_raw (GdaThreadWrapper *wrapper,
td->signals_list = g_slist_append (td->signals_list, sigspec);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return sigspec->signal_id;
}
@@ -1698,11 +1519,7 @@ gda_thread_wrapper_disconnect (GdaThreadWrapper *wrapper, gulong id)
g_return_if_fail (GDA_IS_THREAD_WRAPPER (wrapper));
g_return_if_fail (wrapper->priv);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
td = g_hash_table_lookup (wrapper->priv->threads_hash, g_thread_self());
if (!td) {
@@ -1712,11 +1529,7 @@ gda_thread_wrapper_disconnect (GdaThreadWrapper *wrapper, gulong id)
}
if (!td) {
g_warning (_("Signal %lu does not exist"), id);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return;
}
@@ -1729,11 +1542,7 @@ gda_thread_wrapper_disconnect (GdaThreadWrapper *wrapper, gulong id)
if (!sigspec) {
g_warning (_("Signal does not exist\n"));
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return;
}
@@ -1758,11 +1567,7 @@ gda_thread_wrapper_disconnect (GdaThreadWrapper *wrapper, gulong id)
/* remove this ThreadData */
g_hash_table_remove (wrapper->priv->threads_hash, g_thread_self());
}
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
}
/**
@@ -1785,31 +1590,19 @@ gda_thread_wrapper_steal_signal (GdaThreadWrapper *wrapper, gulong id)
g_return_if_fail (wrapper->priv);
g_return_if_fail (id > 0);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_lock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_lock (wrapper->priv->mutex);
-#endif
gulong theid = id;
old_td = g_hash_table_find (wrapper->priv->threads_hash,
(GHRFunc) find_signal_r_func, &theid);
if (!old_td) {
g_warning (_("Signal %lu does not exist"), id);
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return;
}
if (old_td->owner == g_thread_self ()) {
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
return;
}
@@ -1829,9 +1622,5 @@ gda_thread_wrapper_steal_signal (GdaThreadWrapper *wrapper, gulong id)
}
}
-#if GLIB_CHECK_VERSION(2,31,7)
g_rec_mutex_unlock (&(wrapper->priv->rmutex));
-#else
- gda_mutex_unlock (wrapper->priv->mutex);
-#endif
}
diff --git a/providers/jdbc/jni-wrapper.c b/providers/jdbc/jni-wrapper.c
index 144b8ae..26da6c8 100644
--- a/providers/jdbc/jni-wrapper.c
+++ b/providers/jdbc/jni-wrapper.c
@@ -558,21 +558,12 @@ jni_wrapper_method_call (JNIEnv *jenv, JniWrapperMethod *method, GValue *object,
break;
case 'B':
g_value_init (retval, G_TYPE_CHAR);
-#if GLIB_CHECK_VERSION(2,31,7)
if (method->is_static)
g_value_set_schar (retval,
(*jenv)->CallStaticByteMethodV (jenv, method->klass, method->mid,
args));
else
g_value_set_schar (retval,
(*jenv)->CallByteMethodV (jenv, jobj, method->mid, args));
-#else
- if (method->is_static)
- g_value_set_char (retval,
- (*jenv)->CallStaticByteMethodV (jenv, method->klass, method->mid,
args));
- else
- g_value_set_char (retval,
- (*jenv)->CallByteMethodV (jenv, jobj, method->mid, args));
-#endif
break;
case 'C':
g_value_init (retval, G_TYPE_INT); // FIXME: should be an unsigned 16 bits value
@@ -781,21 +772,12 @@ jni_wrapper_field_get (JNIEnv *jenv, JniWrapperField *field, GValue *object, GEr
break;
case 'B':
g_value_init (retval, G_TYPE_CHAR);
-#if GLIB_CHECK_VERSION(2,31,7)
if (field->is_static)
g_value_set_schar (retval,
(*jenv)->GetStaticByteField (jenv, field->klass, field->fid));
else
g_value_set_schar (retval,
(*jenv)->GetByteField (jenv, jobj, field->fid));
-#else
- if (field->is_static)
- g_value_set_char (retval,
- (*jenv)->GetStaticByteField (jenv, field->klass, field->fid));
- else
- g_value_set_char (retval,
- (*jenv)->GetByteField (jenv, jobj, field->fid));
-#endif
break;
case 'C':
g_value_init (retval, G_TYPE_INT); // FIXME: should be an unsigned 16 bits value
@@ -945,17 +927,10 @@ jni_wrapper_field_set (JNIEnv *jenv, JniWrapperField *field,
case 'B':
if (G_VALUE_TYPE (value) != G_TYPE_CHAR)
goto wrong_type;
-#if GLIB_CHECK_VERSION(2,31,7)
if (field->is_static)
(*jenv)->SetStaticByteField (jenv, field->klass, field->fid, g_value_get_schar
(value));
else
(*jenv)->SetByteField (jenv, jobj, field->fid, g_value_get_schar (value));
-#else
- if (field->is_static)
- (*jenv)->SetStaticByteField (jenv, field->klass, field->fid, g_value_get_char
(value));
- else
- (*jenv)->SetByteField (jenv, jobj, field->fid, g_value_get_char (value));
-#endif
break;
case 'C':
if (G_VALUE_TYPE (value) != G_TYPE_INT)
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index 37d8bbd..ab5e64b 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -2555,15 +2555,9 @@ gda_mysql_provider_statement_execute (GdaServerProvider *provider,
mysql_bind_param[i].length = NULL;
}
else if (G_VALUE_TYPE (value) == G_TYPE_CHAR) {
-#if GLIB_CHECK_VERSION(2,31,7)
gint8 *pv;
pv = g_new (gint8, 1);
*pv = g_value_get_schar (value);
-#else
- gchar *pv;
- pv = g_new (gchar, 1);
- *pv = g_value_get_char (value);
-#endif
mem_to_free = g_slist_prepend (mem_to_free, pv);
mysql_bind_param[i].buffer_type= MYSQL_TYPE_TINY;
mysql_bind_param[i].buffer = pv;
diff --git a/providers/oracle/gda-oracle-util.c b/providers/oracle/gda-oracle-util.c
index 57cfb67..0571846 100644
--- a/providers/oracle/gda-oracle-util.c
+++ b/providers/oracle/gda-oracle-util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2013 Vivien Malerba <malerba gnome-db org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -652,11 +652,7 @@ _gda_oracle_set_value (GValue *value,
}
case GDA_STYPE_CHAR: {
TO_IMPLEMENT; /* test that value fits in */
-#if GLIB_CHECK_VERSION(2,31,7)
g_value_set_schar (value, *((gint8*) ora_value->value));
-#else
- g_value_set_char (value, *((gchar*) ora_value->value));
-#endif
break;
}
case GDA_STYPE_SHORT: {
diff --git a/providers/web/gda-web-util.c b/providers/web/gda-web-util.c
index 7add4b0..c1169e1 100644
--- a/providers/web/gda-web-util.c
+++ b/providers/web/gda-web-util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2013 Vivien Malerba <malerba gnome-db org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -338,21 +338,12 @@ start_worker (GdaConnection *cnc, WebConnectionData *cdata)
cdata->worker_running = TRUE;
gda_mutex_unlock (cdata->mutex);
-#if GLIB_CHECK_VERSION(2,31,7)
if (! g_thread_new ("web-worker", (GThreadFunc) start_worker_in_sub_thread,
thdata)) {
g_free (thdata);
gda_connection_add_event_string (cnc, _("Can't start new thread"));
return;
}
-#else
- if (! g_thread_create ((GThreadFunc) start_worker_in_sub_thread,
- thdata, FALSE, NULL)) {
- g_free (thdata);
- gda_connection_add_event_string (cnc, _("Can't start new thread"));
- return;
- }
-#endif
gint nb_retries;
for (nb_retries = 0; nb_retries < 10; nb_retries++) {
diff --git a/tools/browser/browser-connection-priv.h b/tools/browser/browser-connection-priv.h
index c448d79..2786b20 100644
--- a/tools/browser/browser-connection-priv.h
+++ b/tools/browser/browser-connection-priv.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2013 Vivien Malerba <malerba gnome-db org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -42,11 +42,7 @@ struct _BrowserConnectionPrivate {
GdaSqlParser *parser;
GdaDsnInfo dsn_info;
-#if GLIB_CHECK_VERSION(2,31,7)
GMutex mstruct_mutex;
-#else
- GMutex *p_mstruct_mutex;
-#endif
GSList *p_mstruct_list; /* private GdaMetaStruct list: while they are being created */
GdaMetaStruct *c_mstruct; /* last GdaMetaStruct up to date, ready to be passed as @mstruct */
GdaMetaStruct *mstruct; /* public GdaMetaStruct: once it has been created and is no more modified */
diff --git a/tools/browser/browser-connection.c b/tools/browser/browser-connection.c
index b23ac35..b38b2c1 100644
--- a/tools/browser/browser-connection.c
+++ b/tools/browser/browser-connection.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2010 Murray Cumming <murrayc murrayc com>
*
@@ -117,21 +117,11 @@ my_unlock (GMutex *mutex, gint where)
g_print ("tmp UNL %p (th %p)@line %d\n", mutex, g_thread_self(), where);
}
-#if GLIB_CHECK_VERSION(2,31,7)
-#define MUTEX_LOCK(bcnc) g_mutex_lock (&((bcnc)->priv->mstruct_mutex))
-#define MUTEX_UNLOCK(bcnc) g_mutex_unlock (&((bcnc)->priv->mstruct_mutex))
-#else
-#define MUTEX_LOCK(bcnc) my_lock ((bcnc)->priv->p_mstruct_mutex,__LINE__)
-#define MUTEX_UNLOCK(bcnc) my_unlock ((bcnc)->priv->p_mstruct_mutex,__LINE__)
-#endif
+ #define MUTEX_LOCK(bcnc) g_mutex_lock (&((bcnc)->priv->mstruct_mutex))
+ #define MUTEX_UNLOCK(bcnc) g_mutex_unlock (&((bcnc)->priv->mstruct_mutex))
#else /* GDA_DEBUG_MUTEX */
-#if GLIB_CHECK_VERSION(2,31,7)
-#define MUTEX_LOCK(bcnc) g_mutex_lock (&((bcnc)->priv->mstruct_mutex))
-#define MUTEX_UNLOCK(bcnc) g_mutex_unlock (&((bcnc)->priv->mstruct_mutex))
-#else
-#define MUTEX_LOCK(bcnc) g_mutex_lock ((bcnc)->priv->p_mstruct_mutex)
-#define MUTEX_UNLOCK(bcnc) g_mutex_unlock ((bcnc)->priv->p_mstruct_mutex)
-#endif
+ #define MUTEX_LOCK(bcnc) g_mutex_lock (&((bcnc)->priv->mstruct_mutex))
+ #define MUTEX_UNLOCK(bcnc) g_mutex_unlock (&((bcnc)->priv->mstruct_mutex))
#endif /* GDA_DEBUG_MUTEX */
/*
@@ -395,11 +385,7 @@ browser_connection_init (BrowserConnection *bcnc)
bcnc->priv->parser = NULL;
bcnc->priv->variables = NULL;
memset (&(bcnc->priv->dsn_info), 0, sizeof (GdaDsnInfo));
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_init (&bcnc->priv->mstruct_mutex);
-#else
- bcnc->priv->p_mstruct_mutex = g_mutex_new ();
-#endif
bcnc->priv->p_mstruct_list = NULL;
bcnc->priv->c_mstruct = NULL;
bcnc->priv->mstruct = NULL;
@@ -811,12 +797,7 @@ browser_connection_dispose (GObject *object)
g_slist_foreach (bcnc->priv->p_mstruct_list, (GFunc) g_object_unref, NULL);
g_slist_free (bcnc->priv->p_mstruct_list);
}
-#if GLIB_CHECK_VERSION(2,31,7)
g_mutex_clear (&bcnc->priv->mstruct_mutex);
-#else
- if (bcnc->priv->p_mstruct_mutex)
- g_mutex_free (bcnc->priv->p_mstruct_mutex);
-#endif
if (bcnc->priv->cnc)
g_object_unref (bcnc->priv->cnc);
diff --git a/tools/browser/browser-page.c b/tools/browser/browser-page.c
index 07c8804..b95ccae 100644
--- a/tools/browser/browser-page.c
+++ b/tools/browser/browser-page.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2010 David King <davidk openismus com>
*
* This program is free software; you can redistribute it and/or
@@ -19,15 +19,9 @@
#include "browser-page.h"
#include "browser-perspective.h"
-#if GLIB_CHECK_VERSION(2,31,7)
static GRecMutex init_rmutex;
#define MUTEX_LOCK() g_rec_mutex_lock(&init_rmutex)
#define MUTEX_UNLOCK() g_rec_mutex_unlock(&init_rmutex)
-#else
-static GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
-#define MUTEX_LOCK() g_static_rec_mutex_lock(&init_mutex)
-#define MUTEX_UNLOCK() g_static_rec_mutex_unlock(&init_mutex)
-#endif
static void browser_page_class_init (gpointer g_class);
GType
diff --git a/tools/browser/browser-perspective.c b/tools/browser/browser-perspective.c
index a62c5a0..3bf8f1a 100644
--- a/tools/browser/browser-perspective.c
+++ b/tools/browser/browser-perspective.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2011 Murray Cumming <murrayc murrayc com>
*
@@ -23,15 +23,9 @@
#include "browser-window.h"
#include "support.h"
-#if GLIB_CHECK_VERSION(2,31,7)
static GRecMutex init_rmutex;
#define MUTEX_LOCK() g_rec_mutex_lock(&init_rmutex)
#define MUTEX_UNLOCK() g_rec_mutex_unlock(&init_rmutex)
-#else
-static GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
-#define MUTEX_LOCK() g_static_rec_mutex_lock(&init_mutex)
-#define MUTEX_UNLOCK() g_static_rec_mutex_unlock(&init_mutex)
-#endif
static void browser_perspective_class_init (gpointer g_class);
GType
diff --git a/tools/gda-threader.c b/tools/gda-threader.c
index 2f3716e..133894d 100644
--- a/tools/gda-threader.c
+++ b/tools/gda-threader.c
@@ -130,8 +130,6 @@ gda_threader_init (GdaThreader * thread)
if (! g_thread_supported())
g_warning ("You must initialize the multi threads environment using g_thread_init()");
- if (getenv ("LIBGDA_NO_THREADS"))
- g_warning ("The LIBGDA_NO_THREADS environment variable has been set, threading not
supported");
thread->priv->next_job = 1;
thread->priv->nb_jobs = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]