File ORBit2-2.14.19-gthread.patch of Package mingw64-orbit2
diff -urEbwB ORBit2-2.14.19/linc2/src/linc.c ORBit2-2.14.19/linc2/src/linc.c
--- ORBit2-2.14.19/linc2/src/linc.c 2010-02-09 13:05:35.000000000 +0100
+++ ORBit2-2.14.19/linc2/src/linc.c 2013-04-02 08:29:33.182503613 +0200
@@ -196,10 +196,7 @@
}
#endif
- if (thread_safe && !g_thread_supported ())
- g_thread_init (NULL);
-
- link_is_thread_safe = (thread_safe && g_thread_supported());
+ link_is_thread_safe = (thread_safe);
g_type_init ();
@@ -259,8 +256,10 @@
link_main_lock = link_mutex_new ();
link_cmd_queue_lock = link_mutex_new ();
if (link_is_thread_safe) {
- link_main_cond = g_cond_new ();
- link_cmd_queue_cond = g_cond_new ();
+ link_main_cond = (GCond*) g_malloc (sizeof(GCond));
+ link_cmd_queue_cond = (GCond*) g_malloc (sizeof(GCond));
+ g_cond_init( link_main_cond );
+ g_cond_init( link_cmd_queue_cond );
}
#ifdef HAVE_WINSOCK2_H
@@ -321,7 +320,11 @@
link_mutex_new (void)
{
if (link_is_thread_safe)
- return g_mutex_new ();
+ {
+ GMutex *retVal = g_new0(GMutex, 1);
+ g_mutex_init(retVal);
+ return retVal;
+ }
else
return NULL;
}
@@ -459,9 +462,8 @@
NULL, (G_IO_IN | G_IO_PRI),
link_mainloop_handle_input, NULL);
- link_io_thread = g_thread_create_full
- (link_io_thread_fn, NULL, 256 * 1024, TRUE, FALSE,
- G_THREAD_PRIORITY_NORMAL, &error);
+ link_io_thread = g_thread_try_new
+ ("link_io_thread_fn", link_io_thread_fn, NULL, &error);
if (!link_io_thread || error)
g_error ("Failed to create linc worker thread");
diff -urEbwB ORBit2-2.14.19/linc2/src/linc-connection.c ORBit2-2.14.19/linc2/src/linc-connection.c
--- ORBit2-2.14.19/linc2/src/linc-connection.c 2010-02-09 13:05:35.000000000 +0100
+++ ORBit2-2.14.19/linc2/src/linc-connection.c 2013-04-02 08:26:13.161344857 +0200
@@ -1335,7 +1335,7 @@
g_free (cnx->priv);
if (cnx->timeout_mutex)
- g_mutex_free (cnx->timeout_mutex);
+ g_mutex_clear (cnx->timeout_mutex);
if (cnx->timeout_source_id)
link_io_thread_remove_timeout (cnx->timeout_source_id);