[libgda] gda-connection: improved multi-threading behavior
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] gda-connection: improved multi-threading behavior
- Date: Wed, 26 Sep 2018 22:37:52 +0000 (UTC)
commit 6e781cd2946c919e14e376e9f0812bdc045ce9aa
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Sep 26 14:42:51 2018 -0500
gda-connection: improved multi-threading behavior
NEWS | 29 +++++++++++++++++++++++++
libgda/gda-connection.c | 58 ++++++++++++++++++++++++++++++-------------------
2 files changed, 65 insertions(+), 22 deletions(-)
---
diff --git a/NEWS b/NEWS
index 38605a57f..06993370d 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,35 @@ libgda-ui 5.90.0
- Improved GObject Introspection bindings
- Improved Vala Bindings
+libgda 5.2.5
+ - GdaConnection has removed the use of g_object_weak_*, improving
+ multi-threading behaviour
+ - Updated SQLite to 3.8.11.1
+ - Fix SQLCipher build by embedding source code for 3.4.2 version
+ - Fix SQLCipher disabling
+ - Fix Doc generation
+ - Bugs corrected: #787685 #789382 #761560 #761529 #760420 #761424 #754263 #754208
+ - Corrected HTML output containing <SCRIPT> tag
+ - Correct some truncated help strings
+ - Don't use (deprecated) g_thread_supported()
+ - MySQL meta data: fixed case where schema is incomplete in MySQL database
+ - Allow introspection for gda_sql_builder_add_cond_v()
+ - SQLite: handle WITHOUT ROWID without any error
+ - Translations:
+ - es (Daniel Mustieles)
+ - da (Ask Hjorth Larsen)
+ - pt_BR (Rafael Fontenelle)
+ - eu (Inaki Larranaga Murgoitio)
+ - sr (Мирослав Николић)
+ - sv (Anders Jonsson)
+ - de (Mario Blättermann)
+ - cs (Marek Černocký)
+ - hu (Balázs Meskó)
+ - oc (Balázs Meskó)
+ - el (Tom Tryfonidis)
+ - po (Pedro Albuquerque)
+ - id (Andika Triwidada)
+
libgda 5.2.4
libgda 5.2.3
libgda 5.2.2, 2013-12-23
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 75a5be108..964ab97cf 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -5867,19 +5867,19 @@ gda_connection_internal_reset_transaction_status (GdaConnection *cnc)
*/
static void prepared_stmts_stmt_reset_cb (GdaStatement *gda_stmt, GdaConnection *cnc);
-static void statement_weak_notify_cb (GdaConnection *cnc, GdaStatement *stmt);
-static void
+static void
prepared_stmts_stmt_reset_cb (GdaStatement *gda_stmt, GdaConnection *cnc)
{
g_return_if_fail (GDA_IS_CONNECTION (cnc));
GdaConnectionPrivate *priv = gda_connection_get_instance_private (cnc);
gda_connection_lock ((GdaLockable*) cnc);
+ g_object_ref (gda_stmt);
g_signal_handlers_disconnect_by_func (gda_stmt, G_CALLBACK (prepared_stmts_stmt_reset_cb), cnc);
- g_object_weak_unref (G_OBJECT (gda_stmt), (GWeakNotify) statement_weak_notify_cb, cnc);
g_assert (priv->prepared_stmts);
g_hash_table_remove (priv->prepared_stmts, gda_stmt);
+ g_object_unref (gda_stmt);
gda_connection_unlock ((GdaLockable*) cnc);
}
@@ -5887,23 +5887,29 @@ prepared_stmts_stmt_reset_cb (GdaStatement *gda_stmt, GdaConnection *cnc)
static void
prepared_stms_foreach_func (GdaStatement *gda_stmt, G_GNUC_UNUSED GdaPStmt *prepared_stmt, GdaConnection
*cnc)
{
+ g_object_ref (gda_stmt);
g_signal_handlers_disconnect_by_func (gda_stmt, G_CALLBACK (prepared_stmts_stmt_reset_cb), cnc);
- g_object_weak_unref (G_OBJECT (gda_stmt), (GWeakNotify) statement_weak_notify_cb, cnc);
+ g_object_unref (gda_stmt);
}
-static void
-statement_weak_notify_cb (GdaConnection *cnc, GdaStatement *stmt)
-{
- g_return_if_fail (GDA_IS_CONNECTION (cnc));
- GdaConnectionPrivate *priv = gda_connection_get_instance_private (cnc);
- gda_connection_lock ((GdaLockable*) cnc);
-
- g_assert (priv->prepared_stmts);
- g_hash_table_remove (priv->prepared_stmts, stmt);
+typedef struct {
+ GdaStatement *statement;
+ GdaPStmt *prepared_stmt;
+} PreparedStatementRef;
- gda_connection_unlock ((GdaLockable*) cnc);
+PreparedStatementRef*
+_gda_prepared_estatement_new (GdaStatement *stmt, GdaPStmt *pstmt) {
+ PreparedStatementRef *nps = g_new0(PreparedStatementRef,1);
+ nps->statement = g_object_ref (stmt);
+ nps->prepared_stmt = g_object_ref (pstmt);
+ return nps;
}
+void
+_gda_prepared_estatement_free (PreparedStatementRef *ps) {
+ g_object_unref (ps->statement);
+ g_object_unref (ps->prepared_stmt);
+}
/**
* gda_connection_add_prepared_statement:
@@ -5923,22 +5929,25 @@ gda_connection_add_prepared_statement (GdaConnection *cnc, GdaStatement *gda_stm
g_return_if_fail (GDA_IS_CONNECTION (cnc));
g_return_if_fail (GDA_IS_STATEMENT (gda_stmt));
g_return_if_fail (GDA_IS_PSTMT (prepared_stmt));
- GdaConnectionPrivate *priv = gda_connection_get_instance_private (cnc);
+ g_object_ref (prepared_stmt);
+ g_object_ref (gda_stmt);
gda_connection_lock ((GdaLockable*) cnc);
+ GdaConnectionPrivate *priv = gda_connection_get_instance_private (cnc);
if (!priv->prepared_stmts)
priv->prepared_stmts = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL, g_object_unref);
+ NULL, _gda_prepared_estatement_free);
g_hash_table_remove (priv->prepared_stmts, gda_stmt);
- g_hash_table_insert (priv->prepared_stmts, gda_stmt, g_object_ref (prepared_stmt));
+ PreparedStatementRef *ref = _gda_prepared_estatement_new (gda_stmt, prepared_stmt);
+ g_hash_table_insert (priv->prepared_stmts, gda_stmt, ref);
- /* destroy the prepared statement if gda_stmt is destroyed, or changes */
- g_object_weak_ref (G_OBJECT (gda_stmt), (GWeakNotify) statement_weak_notify_cb, cnc);
g_signal_connect (G_OBJECT (gda_stmt), "reset",
G_CALLBACK (prepared_stmts_stmt_reset_cb), cnc);
gda_connection_unlock ((GdaLockable*) cnc);
+ g_object_unref (prepared_stmt);
+ g_object_unref (gda_stmt);
}
/**
@@ -5960,8 +5969,11 @@ gda_connection_get_prepared_statement (GdaConnection *cnc, GdaStatement *gda_stm
GdaConnectionPrivate *priv = gda_connection_get_instance_private (cnc);
gda_connection_lock ((GdaLockable*) cnc);
- if (priv->prepared_stmts)
- retval = g_hash_table_lookup (priv->prepared_stmts, gda_stmt);
+ if (priv->prepared_stmts) {
+ PreparedStatementRef *ref = g_hash_table_lookup (priv->prepared_stmts, gda_stmt);
+ if (ref)
+ retval = ref->prepared_stmt;
+ }
gda_connection_unlock ((GdaLockable*) cnc);
return retval;
@@ -5978,12 +5990,14 @@ gda_connection_get_prepared_statement (GdaConnection *cnc, GdaStatement *gda_stm
void
gda_connection_del_prepared_statement (GdaConnection *cnc, GdaStatement *gda_stmt)
{
- g_return_if_fail (GDA_IS_CONNECTION (cnc));
+ g_return_if_fail (cnc != NULL);
gda_connection_lock ((GdaLockable*) cnc);
g_return_if_fail (GDA_IS_CONNECTION (cnc));
+ g_object_ref (gda_stmt);
if (gda_connection_get_prepared_statement (cnc, gda_stmt))
prepared_stmts_stmt_reset_cb (gda_stmt, cnc);
+ g_object_unref (gda_stmt);
gda_connection_unlock ((GdaLockable*) cnc);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]