836 lines
23 KiB
Diff
836 lines
23 KiB
Diff
--- daemon/daemon-connection.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ daemon/daemon-connection.c 2013-05-06 23:42:57.000000000 +0200
|
|
@@ -67,14 +67,14 @@
|
|
gint32 id;
|
|
} FileHandle;
|
|
|
|
-static GStaticMutex cancellations_lock = G_STATIC_MUTEX_INIT;
|
|
+static GMutex cancellations_lock;
|
|
static GHashTable *cancellations;
|
|
|
|
-static GStaticMutex directory_handles_lock = G_STATIC_MUTEX_INIT;
|
|
+static GMutex directory_handles_lock;
|
|
static GHashTable *directory_handles;
|
|
static guint next_directory_id = 1;
|
|
|
|
-static GStaticMutex file_handles_lock = G_STATIC_MUTEX_INIT;
|
|
+static GMutex file_handles_lock;
|
|
static GHashTable *file_handles;
|
|
static guint next_file_id = 1;
|
|
|
|
@@ -239,21 +239,21 @@
|
|
}
|
|
dbus_connection_unref (conn->conn);
|
|
|
|
- g_static_mutex_lock (&directory_handles_lock);
|
|
+ g_mutex_lock (&directory_handles_lock);
|
|
if (directory_handles) {
|
|
g_hash_table_foreach_remove (directory_handles,
|
|
directory_handle_last_conn_is,
|
|
conn);
|
|
}
|
|
- g_static_mutex_unlock (&directory_handles_lock);
|
|
+ g_mutex_unlock (&directory_handles_lock);
|
|
|
|
- g_static_mutex_lock (&file_handles_lock);
|
|
+ g_mutex_lock (&file_handles_lock);
|
|
if (file_handles) {
|
|
g_hash_table_foreach_remove (file_handles,
|
|
file_handle_last_conn_is,
|
|
conn);
|
|
}
|
|
- g_static_mutex_unlock (&file_handles_lock);
|
|
+ g_mutex_unlock (&file_handles_lock);
|
|
|
|
g_assert (!g_main_loop_is_running (conn->main_loop));
|
|
|
|
@@ -320,14 +320,14 @@
|
|
|
|
handle = cancellation_handle_new (id, conn->conn_id);
|
|
|
|
- g_static_mutex_lock (&cancellations_lock);
|
|
+ g_mutex_lock (&cancellations_lock);
|
|
if (cancellations == NULL) {
|
|
cancellations = g_hash_table_new_full (cancellation_handle_hash, cancellation_handle_equal,
|
|
NULL, (GDestroyNotify) cancellation_handle_free);
|
|
}
|
|
|
|
g_hash_table_insert (cancellations, handle, handle);
|
|
- g_static_mutex_unlock (&cancellations_lock);
|
|
+ g_mutex_unlock (&cancellations_lock);
|
|
|
|
return handle;
|
|
}
|
|
@@ -338,11 +338,11 @@
|
|
{
|
|
d(g_print ("Removing cancellation handle %d\n", handle->id));
|
|
|
|
- g_static_mutex_lock (&cancellations_lock);
|
|
+ g_mutex_lock (&cancellations_lock);
|
|
if (!g_hash_table_remove (cancellations, handle)) {
|
|
g_warning ("Could't remove cancellation.");
|
|
}
|
|
- g_static_mutex_unlock (&cancellations_lock);
|
|
+ g_mutex_unlock (&cancellations_lock);
|
|
}
|
|
|
|
/* Note: This is called from the main thread. */
|
|
@@ -354,7 +354,7 @@
|
|
|
|
handle = NULL;
|
|
|
|
- g_static_mutex_lock (&cancellations_lock);
|
|
+ g_mutex_lock (&cancellations_lock);
|
|
|
|
lookup.conn_id = conn_id;
|
|
lookup.id = cancellation_id;
|
|
@@ -368,7 +368,7 @@
|
|
}
|
|
}
|
|
|
|
- g_static_mutex_unlock (&cancellations_lock);
|
|
+ g_mutex_unlock (&cancellations_lock);
|
|
}
|
|
|
|
|
|
@@ -408,7 +408,7 @@
|
|
{
|
|
DirectoryHandle *handle;
|
|
|
|
- g_static_mutex_lock (&directory_handles_lock);
|
|
+ g_mutex_lock (&directory_handles_lock);
|
|
handle = directory_handle_new (conn, vfs_handle, next_directory_id++);
|
|
|
|
if (directory_handles == NULL) {
|
|
@@ -418,7 +418,7 @@
|
|
|
|
g_hash_table_insert (directory_handles,
|
|
GINT_TO_POINTER (handle->id), handle);
|
|
- g_static_mutex_unlock (&directory_handles_lock);
|
|
+ g_mutex_unlock (&directory_handles_lock);
|
|
|
|
return handle;
|
|
}
|
|
@@ -426,13 +426,13 @@
|
|
static void
|
|
remove_directory_handle (DirectoryHandle *handle)
|
|
{
|
|
- g_static_mutex_lock (&directory_handles_lock);
|
|
+ g_mutex_lock (&directory_handles_lock);
|
|
if (!g_hash_table_remove (directory_handles,
|
|
GINT_TO_POINTER (handle->id))) {
|
|
g_warning ("Couldn't remove directory handle %d\n",
|
|
handle->id);
|
|
}
|
|
- g_static_mutex_unlock (&directory_handles_lock);
|
|
+ g_mutex_unlock (&directory_handles_lock);
|
|
}
|
|
|
|
static DirectoryHandle *
|
|
@@ -441,13 +441,13 @@
|
|
{
|
|
DirectoryHandle *handle;
|
|
|
|
- g_static_mutex_lock (&directory_handles_lock);
|
|
+ g_mutex_lock (&directory_handles_lock);
|
|
handle = g_hash_table_lookup (directory_handles,
|
|
GINT_TO_POINTER (id));
|
|
if (handle) {
|
|
handle->last_connection = conn;
|
|
}
|
|
- g_static_mutex_unlock (&directory_handles_lock);
|
|
+ g_mutex_unlock (&directory_handles_lock);
|
|
return handle;
|
|
}
|
|
|
|
@@ -487,7 +487,7 @@
|
|
{
|
|
FileHandle *handle;
|
|
|
|
- g_static_mutex_lock (&file_handles_lock);
|
|
+ g_mutex_lock (&file_handles_lock);
|
|
handle = file_handle_new (conn, vfs_handle, next_file_id++);
|
|
|
|
if (file_handles == NULL) {
|
|
@@ -497,7 +497,7 @@
|
|
|
|
g_hash_table_insert (file_handles,
|
|
GINT_TO_POINTER (handle->id), handle);
|
|
- g_static_mutex_unlock (&file_handles_lock);
|
|
+ g_mutex_unlock (&file_handles_lock);
|
|
|
|
return handle;
|
|
}
|
|
@@ -505,12 +505,12 @@
|
|
static void
|
|
remove_file_handle (FileHandle *handle)
|
|
{
|
|
- g_static_mutex_lock (&file_handles_lock);
|
|
+ g_mutex_lock (&file_handles_lock);
|
|
if (!g_hash_table_remove (file_handles,
|
|
GINT_TO_POINTER (handle->id))) {
|
|
g_warning ("Couldn't remove file handle %d\n", handle->id);
|
|
}
|
|
- g_static_mutex_unlock (&file_handles_lock);
|
|
+ g_mutex_unlock (&file_handles_lock);
|
|
}
|
|
|
|
static FileHandle *
|
|
@@ -519,13 +519,13 @@
|
|
{
|
|
FileHandle *handle;
|
|
|
|
- g_static_mutex_lock (&file_handles_lock);
|
|
+ g_mutex_lock (&file_handles_lock);
|
|
handle = g_hash_table_lookup (file_handles,
|
|
GINT_TO_POINTER (id));
|
|
if (handle) {
|
|
handle->last_connection = conn;
|
|
}
|
|
- g_static_mutex_unlock (&file_handles_lock);
|
|
+ g_mutex_unlock (&file_handles_lock);
|
|
|
|
return handle;
|
|
}
|
|
--- libgnomevfs/gnome-vfs-async-job-map.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ libgnomevfs/gnome-vfs-async-job-map.c 2013-05-06 23:43:56.000000000 +0200
|
|
@@ -27,14 +27,14 @@
|
|
#include <glib.h>
|
|
|
|
/* job map bits guarded by this lock */
|
|
-static GStaticRecMutex async_job_map_lock = G_STATIC_REC_MUTEX_INIT;
|
|
+static GRecMutex async_job_map_lock;
|
|
static guint async_job_map_next_id;
|
|
static int async_job_map_locked = 0;
|
|
static gboolean async_job_map_shutting_down;
|
|
static GHashTable *async_job_map;
|
|
|
|
/* callback map bits guarded by this lock */
|
|
-static GStaticMutex async_job_callback_map_lock = G_STATIC_MUTEX_INIT;
|
|
+static GMutex async_job_callback_map_lock;
|
|
static GHashTable *async_job_callback_map;
|
|
static guint async_job_callback_map_next_id;
|
|
|
|
@@ -161,7 +161,7 @@
|
|
void
|
|
_gnome_vfs_async_job_map_lock (void)
|
|
{
|
|
- g_static_rec_mutex_lock (&async_job_map_lock);
|
|
+ g_rec_mutex_lock (&async_job_map_lock);
|
|
async_job_map_locked++;
|
|
}
|
|
|
|
@@ -169,7 +169,7 @@
|
|
_gnome_vfs_async_job_map_unlock (void)
|
|
{
|
|
async_job_map_locked--;
|
|
- g_static_rec_mutex_unlock (&async_job_map_lock);
|
|
+ g_rec_mutex_unlock (&async_job_map_lock);
|
|
}
|
|
|
|
void
|
|
@@ -185,7 +185,7 @@
|
|
{
|
|
GnomeVFSNotifyResult *notify_result;
|
|
|
|
- g_static_mutex_lock (&async_job_callback_map_lock);
|
|
+ g_mutex_lock (&async_job_callback_map_lock);
|
|
|
|
if (async_job_callback_map == NULL) {
|
|
g_assert (async_job_map_shutting_down);
|
|
@@ -199,7 +199,7 @@
|
|
*valid = notify_result != NULL;
|
|
*cancelled = notify_result != NULL && notify_result->cancelled;
|
|
|
|
- g_static_mutex_unlock (&async_job_callback_map_lock);
|
|
+ g_mutex_unlock (&async_job_callback_map_lock);
|
|
}
|
|
|
|
gboolean
|
|
@@ -207,7 +207,7 @@
|
|
{
|
|
gboolean cancelled;
|
|
|
|
- g_static_mutex_lock (&async_job_callback_map_lock);
|
|
+ g_mutex_lock (&async_job_callback_map_lock);
|
|
|
|
g_assert (!async_job_map_shutting_down);
|
|
|
|
@@ -232,7 +232,7 @@
|
|
g_hash_table_insert (async_job_callback_map, GUINT_TO_POINTER (notify_result->callback_id),
|
|
notify_result);
|
|
}
|
|
- g_static_mutex_unlock (&async_job_callback_map_lock);
|
|
+ g_mutex_unlock (&async_job_callback_map_lock);
|
|
|
|
return !cancelled;
|
|
}
|
|
@@ -243,11 +243,11 @@
|
|
g_assert (async_job_callback_map != NULL);
|
|
|
|
JOB_DEBUG (("removing callback %d ", callback_id));
|
|
- g_static_mutex_lock (&async_job_callback_map_lock);
|
|
+ g_mutex_lock (&async_job_callback_map_lock);
|
|
|
|
g_hash_table_remove (async_job_callback_map, GUINT_TO_POINTER (callback_id));
|
|
|
|
- g_static_mutex_unlock (&async_job_callback_map_lock);
|
|
+ g_mutex_unlock (&async_job_callback_map_lock);
|
|
}
|
|
|
|
static void
|
|
@@ -268,7 +268,7 @@
|
|
void
|
|
_gnome_vfs_async_job_cancel_job_and_callbacks (GnomeVFSAsyncHandle *job_handle, GnomeVFSJob *job)
|
|
{
|
|
- g_static_mutex_lock (&async_job_callback_map_lock);
|
|
+ g_mutex_lock (&async_job_callback_map_lock);
|
|
|
|
if (job != NULL) {
|
|
job->cancelled = TRUE;
|
|
@@ -282,18 +282,18 @@
|
|
callback_map_cancel_one, job_handle);
|
|
}
|
|
|
|
- g_static_mutex_unlock (&async_job_callback_map_lock);
|
|
+ g_mutex_unlock (&async_job_callback_map_lock);
|
|
}
|
|
|
|
void
|
|
async_job_callback_map_destroy (void)
|
|
{
|
|
- g_static_mutex_lock (&async_job_callback_map_lock);
|
|
+ g_mutex_lock (&async_job_callback_map_lock);
|
|
|
|
if (async_job_callback_map) {
|
|
g_hash_table_destroy (async_job_callback_map);
|
|
async_job_callback_map = NULL;
|
|
}
|
|
|
|
- g_static_mutex_unlock (&async_job_callback_map_lock);
|
|
+ g_mutex_unlock (&async_job_callback_map_lock);
|
|
}
|
|
--- libgnomevfs/gnome-vfs-daemon-method.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ libgnomevfs/gnome-vfs-daemon-method.c 2013-05-07 00:20:38.000000000 +0200
|
|
@@ -81,8 +81,17 @@
|
|
static DBusHandlerResult connection_message_func (DBusConnection *conn,
|
|
DBusMessage *message,
|
|
gpointer data);
|
|
+static void
|
|
+destroy_private_connection (gpointer data)
|
|
+{
|
|
+ LocalConnection *ret = data;
|
|
+
|
|
+ dbus_connection_close (ret->connection);
|
|
+ dbus_connection_unref (ret->connection);
|
|
+ g_free (ret);
|
|
+}
|
|
|
|
-static GStaticPrivate local_connection_private = G_STATIC_PRIVATE_INIT;
|
|
+static GPrivate local_connection_private = G_PRIVATE_INIT (destroy_private_connection);
|
|
|
|
|
|
static DBusObjectPathVTable connection_vtable = {
|
|
@@ -343,20 +352,11 @@
|
|
gchar *sender;
|
|
} CancellationRequest;
|
|
|
|
-static void
|
|
-destroy_private_connection (gpointer data)
|
|
-{
|
|
- LocalConnection *ret = data;
|
|
-
|
|
- dbus_connection_close (ret->connection);
|
|
- dbus_connection_unref (ret->connection);
|
|
- g_free (ret);
|
|
-}
|
|
|
|
static void
|
|
private_connection_died (LocalConnection *connection)
|
|
{
|
|
- g_static_private_set (&local_connection_private, NULL, NULL);
|
|
+ g_private_set (&local_connection_private, NULL);
|
|
}
|
|
|
|
static LocalConnection *
|
|
@@ -370,7 +370,7 @@
|
|
dbus_int32_t conn_id;
|
|
LocalConnection *ret;
|
|
|
|
- ret = g_static_private_get (&local_connection_private);
|
|
+ ret = g_private_get (&local_connection_private);
|
|
if (ret != NULL) {
|
|
return ret;
|
|
}
|
|
@@ -438,8 +438,8 @@
|
|
ret->conn_id = conn_id;
|
|
ret->handle = 0;
|
|
|
|
- g_static_private_set (&local_connection_private,
|
|
- ret, destroy_private_connection);
|
|
+ g_private_set (&local_connection_private,
|
|
+ ret);
|
|
|
|
return ret;
|
|
}
|
|
--- libgnomevfs/gnome-vfs-dbus-utils.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ libgnomevfs/gnome-vfs-dbus-utils.c 2013-05-07 00:22:19.000000000 +0200
|
|
@@ -187,16 +187,16 @@
|
|
return main_dbus;
|
|
}
|
|
|
|
-static GStaticPrivate daemon_connection_private = G_STATIC_PRIVATE_INIT;
|
|
+static GPrivate daemon_connection_private;
|
|
|
|
DBusConnection *
|
|
_gnome_vfs_daemon_get_current_connection (void)
|
|
{
|
|
- return g_static_private_get (&daemon_connection_private);
|
|
+ return g_private_get (&daemon_connection_private);
|
|
}
|
|
|
|
void
|
|
gnome_vfs_daemon_set_current_connection (DBusConnection *conn)
|
|
{
|
|
- g_static_private_set (&daemon_connection_private, conn, NULL);
|
|
+ g_private_set (&daemon_connection_private, conn);
|
|
}
|
|
--- libgnomevfs/gnome-vfs-file-info.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ libgnomevfs/gnome-vfs-file-info.c 2013-05-06 23:47:46.000000000 +0200
|
|
@@ -31,7 +31,7 @@
|
|
/* Mutex for making GnomeVFSFileInfo ref's/unref's atomic */
|
|
/* Note that an atomic increment function (such as is present in NSPR) is preferable */
|
|
/* FIXME: This mutex is probably not needed and might be causing performance issues */
|
|
-static GStaticMutex file_info_ref_lock = G_STATIC_MUTEX_INIT;
|
|
+static GMutex file_info_ref_lock;
|
|
|
|
/* Register GnomeVFSFileInfo in the type system */
|
|
GType
|
|
@@ -83,9 +83,9 @@
|
|
g_return_if_fail (info != NULL);
|
|
g_return_if_fail (info->refcount > 0);
|
|
|
|
- g_static_mutex_lock (&file_info_ref_lock);
|
|
+ g_mutex_lock (&file_info_ref_lock);
|
|
info->refcount += 1;
|
|
- g_static_mutex_unlock (&file_info_ref_lock);
|
|
+ g_mutex_unlock (&file_info_ref_lock);
|
|
|
|
}
|
|
|
|
@@ -101,9 +101,9 @@
|
|
g_return_if_fail (info != NULL);
|
|
g_return_if_fail (info->refcount > 0);
|
|
|
|
- g_static_mutex_lock (&file_info_ref_lock);
|
|
+ g_mutex_lock (&file_info_ref_lock);
|
|
info->refcount -= 1;
|
|
- g_static_mutex_unlock (&file_info_ref_lock);
|
|
+ g_mutex_unlock (&file_info_ref_lock);
|
|
|
|
if (info->refcount == 0) {
|
|
gnome_vfs_file_info_clear (info);
|
|
@@ -133,13 +133,13 @@
|
|
g_free (info->selinux_context);
|
|
|
|
/* Ensure the ref count is maintained correctly */
|
|
- g_static_mutex_lock (&file_info_ref_lock);
|
|
+ g_mutex_lock (&file_info_ref_lock);
|
|
|
|
old_refcount = info->refcount;
|
|
memset (info, 0, sizeof (*info));
|
|
info->refcount = old_refcount;
|
|
|
|
- g_static_mutex_unlock (&file_info_ref_lock);
|
|
+ g_mutex_unlock (&file_info_ref_lock);
|
|
}
|
|
|
|
|
|
@@ -182,7 +182,7 @@
|
|
* want serialize access differently (or perhaps you shouldn't
|
|
* use copy)
|
|
*/
|
|
- g_static_mutex_lock (&file_info_ref_lock);
|
|
+ g_mutex_lock (&file_info_ref_lock);
|
|
|
|
old_refcount = dest->refcount;
|
|
|
|
@@ -199,7 +199,7 @@
|
|
|
|
dest->refcount = old_refcount;
|
|
|
|
- g_static_mutex_unlock (&file_info_ref_lock);
|
|
+ g_mutex_unlock (&file_info_ref_lock);
|
|
|
|
}
|
|
|
|
--- libgnomevfs/gnome-vfs-init.c.orig 2010-07-01 17:36:09.000000000 +0200
|
|
+++ libgnomevfs/gnome-vfs-init.c 2013-05-07 11:50:18.000000000 +0200
|
|
@@ -122,8 +122,6 @@
|
|
return FALSE;
|
|
}
|
|
|
|
- if (!g_thread_supported ())
|
|
- g_thread_init (NULL);
|
|
|
|
G_LOCK (vfs_already_initialized);
|
|
|
|
@@ -235,9 +233,5 @@
|
|
gboolean
|
|
gnome_vfs_is_primary_thread (void)
|
|
{
|
|
- if (g_thread_supported()) {
|
|
- return GPOINTER_TO_UINT(g_private_get (private_is_primary_thread)) == 1;
|
|
- } else {
|
|
- return TRUE;
|
|
- }
|
|
+ return GPOINTER_TO_UINT(g_private_get (private_is_primary_thread)) == 1;
|
|
}
|
|
--- libgnomevfs/gnome-vfs-job.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ libgnomevfs/gnome-vfs-job.c 2013-05-07 00:23:25.000000000 +0200
|
|
@@ -43,7 +43,7 @@
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
-static GStaticPrivate job_private = G_STATIC_PRIVATE_INIT;
|
|
+static GPrivate job_private;
|
|
|
|
#if GNOME_VFS_JOB_DEBUG
|
|
|
|
@@ -64,7 +64,7 @@
|
|
* Since this id debug only, just use what the macro should be here.
|
|
* even though it is not portable.
|
|
*/
|
|
-GStaticMutex debug_mutex = G_STATIC_MUTEX_INIT;
|
|
+GMutex debug_mutex;
|
|
#endif
|
|
|
|
static int job_count = 0;
|
|
@@ -1734,9 +1734,9 @@
|
|
set_current_job (GnomeVFSJob *job)
|
|
{
|
|
/* There shouldn't have been anything here. */
|
|
- g_assert (g_static_private_get (&job_private) == NULL);
|
|
+ g_assert (g_private_get (&job_private) == NULL);
|
|
|
|
- g_static_private_set (&job_private, job, NULL);
|
|
+ g_private_set (&job_private, job);
|
|
|
|
_gnome_vfs_module_callback_use_stack_info (job->op->stack_info);
|
|
_gnome_vfs_module_callback_set_in_async_thread (TRUE);
|
|
@@ -1745,7 +1745,7 @@
|
|
static void
|
|
clear_current_job (void)
|
|
{
|
|
- g_static_private_set (&job_private, NULL, NULL);
|
|
+ g_private_set (&job_private, NULL);
|
|
|
|
_gnome_vfs_module_callback_clear_stacks ();
|
|
}
|
|
@@ -1757,7 +1757,7 @@
|
|
|
|
g_return_if_fail (context != NULL);
|
|
|
|
- job = g_static_private_get (&job_private);
|
|
+ job = g_private_get (&job_private);
|
|
|
|
if (job != NULL) {
|
|
*context = job->op->context;
|
|
@@ -1777,7 +1777,7 @@
|
|
GnomeVFSJob *job;
|
|
GnomeVFSNotifyResult notify_result;
|
|
|
|
- job = g_static_private_get (&job_private);
|
|
+ job = g_private_get (&job_private);
|
|
|
|
g_return_if_fail (job != NULL);
|
|
|
|
--- libgnomevfs/gnome-vfs-method.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ libgnomevfs/gnome-vfs-method.c 2013-05-06 23:50:29.000000000 +0200
|
|
@@ -63,7 +63,7 @@
|
|
|
|
static GHashTable *module_hash = NULL;
|
|
G_LOCK_DEFINE_STATIC (gnome_vfs_method_init);
|
|
-static GStaticRecMutex module_hash_lock = G_STATIC_REC_MUTEX_INIT;
|
|
+static GRecMutex module_hash_lock;
|
|
|
|
static GList *module_path_list = NULL;
|
|
|
|
@@ -343,7 +343,7 @@
|
|
const char *args;
|
|
gboolean run_in_daemon;
|
|
|
|
- g_static_rec_mutex_lock (&module_hash_lock);
|
|
+ g_rec_mutex_lock (&module_hash_lock);
|
|
|
|
module_element = g_hash_table_lookup (module_hash, name);
|
|
|
|
@@ -408,7 +408,7 @@
|
|
g_hash_table_insert (module_hash, module_element->name, module_element);
|
|
|
|
add_module_out:
|
|
- g_static_rec_mutex_unlock (&module_hash_lock);
|
|
+ g_rec_mutex_unlock (&module_hash_lock);
|
|
|
|
return module_element;
|
|
}
|
|
--- libgnomevfs/gnome-vfs-module-callback.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ libgnomevfs/gnome-vfs-module-callback.c 2013-05-07 00:10:11.000000000 +0200
|
|
@@ -59,7 +59,7 @@
|
|
|
|
/* -- Global variables -- */
|
|
|
|
-static GStaticMutex callback_table_lock = G_STATIC_MUTEX_INIT;
|
|
+static GMutex callback_table_lock;
|
|
static GHashTable *default_callbacks = NULL;
|
|
static GHashTable *default_async_callbacks = NULL;
|
|
static GHashTable *stack_tables_to_free = NULL;
|
|
@@ -69,7 +69,7 @@
|
|
static GPrivate *in_async_thread_key;
|
|
|
|
static GCond *async_callback_cond;
|
|
-static GStaticMutex async_callback_lock = G_STATIC_MUTEX_INIT;
|
|
+static GMutex async_callback_lock;
|
|
|
|
/* -- Helper functions -- */
|
|
|
|
@@ -120,12 +120,12 @@
|
|
{
|
|
CallbackResponseData *response_data;
|
|
|
|
- g_static_mutex_lock (&async_callback_lock);
|
|
+ g_mutex_lock (&async_callback_lock);
|
|
response_data = data;
|
|
response_data->done = TRUE;
|
|
g_cond_broadcast (async_callback_cond);
|
|
|
|
- g_static_mutex_unlock (&async_callback_lock);
|
|
+ g_mutex_unlock (&async_callback_lock);
|
|
}
|
|
|
|
static void
|
|
@@ -146,7 +146,7 @@
|
|
* new mutexes and condition variables all the time.
|
|
*/
|
|
|
|
- g_static_mutex_lock (&async_callback_lock);
|
|
+ g_mutex_lock (&async_callback_lock);
|
|
response_data.done = FALSE;
|
|
_gnome_vfs_dispatch_module_callback (async_callback->callback,
|
|
in, in_size,
|
|
@@ -156,10 +156,10 @@
|
|
&response_data);
|
|
while (!response_data.done) {
|
|
g_cond_wait (async_callback_cond,
|
|
- g_static_mutex_get_mutex (&async_callback_lock));
|
|
+ &async_callback_lock);
|
|
}
|
|
|
|
- g_static_mutex_unlock (&async_callback_lock);
|
|
+ g_mutex_unlock (&async_callback_lock);
|
|
}
|
|
|
|
static void
|
|
@@ -410,13 +410,13 @@
|
|
|
|
stack_table = specific;
|
|
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
if (stack_tables_to_free != NULL) {
|
|
g_hash_table_remove (stack_tables_to_free, stack_table);
|
|
} else {
|
|
stack_table = NULL;
|
|
}
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
|
|
if (stack_table) {
|
|
clear_stack_table (stack_table);
|
|
@@ -443,11 +443,11 @@
|
|
static void
|
|
free_stack_tables_to_free (void)
|
|
{
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
g_hash_table_foreach_remove (stack_tables_to_free, stack_table_free_hr_func , NULL);
|
|
g_hash_table_destroy (stack_tables_to_free);
|
|
stack_tables_to_free = NULL;
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
}
|
|
|
|
void
|
|
@@ -461,13 +461,13 @@
|
|
|
|
async_callback_cond = g_cond_new ();
|
|
|
|
- g_atexit (free_stack_tables_to_free);
|
|
+ atexit (free_stack_tables_to_free);
|
|
}
|
|
|
|
static void
|
|
free_default_callbacks (void)
|
|
{
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
|
|
clear_callback_table (default_callbacks);
|
|
g_hash_table_destroy (default_callbacks);
|
|
@@ -475,7 +475,7 @@
|
|
clear_callback_table (default_async_callbacks);
|
|
g_hash_table_destroy (default_async_callbacks);
|
|
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
}
|
|
|
|
/* This function should only be called with the mutex held. */
|
|
@@ -486,7 +486,7 @@
|
|
default_callbacks = g_hash_table_new (g_str_hash, g_str_equal);
|
|
default_async_callbacks = g_hash_table_new (g_str_hash, g_str_equal);
|
|
|
|
- g_atexit (free_default_callbacks);
|
|
+ atexit (free_default_callbacks);
|
|
}
|
|
}
|
|
|
|
@@ -496,23 +496,23 @@
|
|
{
|
|
/* Initialize per-thread data, if needed. */
|
|
if (g_private_get (callback_stacks_key) == NULL) {
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
g_private_set (callback_stacks_key,
|
|
g_hash_table_new (g_str_hash, g_str_equal));
|
|
g_hash_table_insert (stack_tables_to_free,
|
|
g_private_get (callback_stacks_key),
|
|
GINT_TO_POINTER (1));
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
}
|
|
|
|
if (g_private_get (async_callback_stacks_key) == NULL) {
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
g_private_set (async_callback_stacks_key,
|
|
g_hash_table_new (g_str_hash, g_str_equal));
|
|
g_hash_table_insert (stack_tables_to_free,
|
|
g_private_get (async_callback_stacks_key),
|
|
GINT_TO_POINTER (1));
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
}
|
|
}
|
|
|
|
@@ -618,12 +618,12 @@
|
|
|
|
callback_info = callback_info_new (callback, callback_data, destroy_notify);
|
|
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
|
|
initialize_global_if_needed ();
|
|
insert_callback_into_table (default_callbacks, callback_name, callback_info);
|
|
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
|
|
callback_info_unref (callback_info);
|
|
}
|
|
@@ -730,12 +730,12 @@
|
|
|
|
callback_info = async_callback_info_new (callback, callback_data, notify);
|
|
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
|
|
initialize_global_if_needed ();
|
|
insert_callback_into_table (default_async_callbacks, callback_name, callback_info);
|
|
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
|
|
callback_info_unref (callback_info);
|
|
}
|
|
@@ -864,13 +864,13 @@
|
|
g_assert (callback != NULL);
|
|
callback_info_ref (callback);
|
|
} else {
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
initialize_global_if_needed ();
|
|
callback = g_hash_table_lookup (default_async_callbacks, callback_name);
|
|
if (callback != NULL) {
|
|
callback_info_ref (callback);
|
|
}
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
}
|
|
}
|
|
|
|
@@ -883,13 +883,13 @@
|
|
g_assert (callback != NULL);
|
|
callback_info_ref (callback);
|
|
} else {
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
initialize_global_if_needed ();
|
|
callback = g_hash_table_lookup (default_callbacks, callback_name);
|
|
if (callback != NULL) {
|
|
callback_info_ref (callback);
|
|
}
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
}
|
|
}
|
|
|
|
@@ -920,9 +920,9 @@
|
|
stack_info->current_callbacks = g_hash_table_new (g_str_hash, g_str_equal);
|
|
stack_info->current_async_callbacks = g_hash_table_new (g_str_hash, g_str_equal);
|
|
|
|
- g_static_mutex_lock (&callback_table_lock);
|
|
+ g_mutex_lock (&callback_table_lock);
|
|
initialize_global_if_needed ();
|
|
- g_static_mutex_unlock (&callback_table_lock);
|
|
+ g_mutex_unlock (&callback_table_lock);
|
|
|
|
initialize_per_thread_if_needed ();
|
|
copy_callback_stack_tops (g_private_get (callback_stacks_key),
|
|
--- libgnomevfs/gnome-vfs-resolve.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ libgnomevfs/gnome-vfs-resolve.c 2013-05-06 23:56:04.000000000 +0200
|
|
@@ -139,11 +139,11 @@
|
|
restart_resolve (void)
|
|
{
|
|
static GTimeVal last_reload = { 0, 0 };
|
|
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
|
+ static GMutex mutex;
|
|
GTimeVal now;
|
|
gboolean ret;
|
|
|
|
- g_static_mutex_lock (&mutex);
|
|
+ g_mutex_lock (&mutex);
|
|
g_get_current_time (&now);
|
|
|
|
if ((now.tv_sec - last_reload.tv_sec) > RELOAD_TIMEVAL) {
|
|
@@ -155,7 +155,7 @@
|
|
ret = FALSE;
|
|
}
|
|
|
|
- g_static_mutex_unlock (&mutex);
|
|
+ g_mutex_unlock (&mutex);
|
|
return ret;
|
|
}
|
|
#else
|
|
--- modules/sftp-method.c.orig 2010-02-09 13:16:14.000000000 +0100
|
|
+++ modules/sftp-method.c 2013-05-07 11:50:33.000000000 +0200
|
|
@@ -1488,8 +1488,6 @@
|
|
invoke_save_auth (uri, keyring, user_name, object, authtype, password);
|
|
}
|
|
|
|
- if (!g_thread_supported ()) g_thread_init (NULL);
|
|
-
|
|
*connection = g_new0 (SftpConnection, 1);
|
|
(*connection)->ref_count = 1;
|
|
(*connection)->in_fd = in_fd;
|