Ticket #38657: patch-port-glib2-2.6.31-and-up.diff

File patch-port-glib2-2.6.31-and-up.diff, 23.3 KB (added by Ionic (Mihai Moldovan), 11 years ago)

Changes required to remove deprecated glib2 functionality in gnome-vfs

  • daemon/daemon-connection.c

    old new  
    6767        gint32            id;
    6868} FileHandle;
    6969
    70 static GStaticMutex cancellations_lock = G_STATIC_MUTEX_INIT;
     70static GMutex cancellations_lock;
    7171static GHashTable *cancellations;
    7272
    73 static GStaticMutex directory_handles_lock = G_STATIC_MUTEX_INIT;
     73static GMutex directory_handles_lock;
    7474static GHashTable *directory_handles;
    7575static guint next_directory_id = 1;
    7676
    77 static GStaticMutex file_handles_lock = G_STATIC_MUTEX_INIT;
     77static GMutex file_handles_lock;
    7878static GHashTable *file_handles;
    7979static guint next_file_id = 1;
    8080
     
    239239        }
    240240        dbus_connection_unref (conn->conn);
    241241
    242         g_static_mutex_lock (&directory_handles_lock);
     242        g_mutex_lock (&directory_handles_lock);
    243243        if (directory_handles) {
    244244                g_hash_table_foreach_remove (directory_handles,
    245245                                             directory_handle_last_conn_is,
    246246                                             conn);
    247247        }
    248         g_static_mutex_unlock (&directory_handles_lock);
     248        g_mutex_unlock (&directory_handles_lock);
    249249       
    250         g_static_mutex_lock (&file_handles_lock);
     250        g_mutex_lock (&file_handles_lock);
    251251        if (file_handles) {
    252252                g_hash_table_foreach_remove (file_handles,
    253253                                             file_handle_last_conn_is,
    254254                                             conn);
    255255        }
    256         g_static_mutex_unlock (&file_handles_lock);
     256        g_mutex_unlock (&file_handles_lock);
    257257       
    258258        g_assert (!g_main_loop_is_running (conn->main_loop));
    259259
     
    320320
    321321        handle = cancellation_handle_new (id, conn->conn_id);
    322322       
    323         g_static_mutex_lock (&cancellations_lock);
     323        g_mutex_lock (&cancellations_lock);
    324324        if (cancellations == NULL) {
    325325                cancellations = g_hash_table_new_full (cancellation_handle_hash, cancellation_handle_equal,
    326326                                                       NULL, (GDestroyNotify) cancellation_handle_free);
    327327        }
    328328       
    329329        g_hash_table_insert (cancellations, handle, handle);
    330         g_static_mutex_unlock (&cancellations_lock);
     330        g_mutex_unlock (&cancellations_lock);
    331331
    332332        return handle;
    333333}
     
    338338{
    339339        d(g_print ("Removing cancellation handle %d\n", handle->id));
    340340
    341         g_static_mutex_lock (&cancellations_lock);
     341        g_mutex_lock (&cancellations_lock);
    342342        if (!g_hash_table_remove (cancellations, handle)) {
    343343                g_warning ("Could't remove cancellation.");
    344344        }
    345         g_static_mutex_unlock (&cancellations_lock);
     345        g_mutex_unlock (&cancellations_lock);
    346346}
    347347
    348348/* Note: This is called from the main thread. */
     
    354354
    355355        handle = NULL;
    356356
    357         g_static_mutex_lock (&cancellations_lock);
     357        g_mutex_lock (&cancellations_lock);
    358358       
    359359        lookup.conn_id = conn_id;
    360360        lookup.id = cancellation_id;
     
    368368                }
    369369        }
    370370       
    371         g_static_mutex_unlock (&cancellations_lock);
     371        g_mutex_unlock (&cancellations_lock);
    372372}
    373373
    374374
     
    408408{
    409409        DirectoryHandle *handle;
    410410
    411         g_static_mutex_lock (&directory_handles_lock);
     411        g_mutex_lock (&directory_handles_lock);
    412412        handle = directory_handle_new (conn, vfs_handle, next_directory_id++);
    413413
    414414        if (directory_handles == NULL) {
     
    418418       
    419419        g_hash_table_insert (directory_handles,
    420420                             GINT_TO_POINTER (handle->id), handle);
    421         g_static_mutex_unlock (&directory_handles_lock);
     421        g_mutex_unlock (&directory_handles_lock);
    422422
    423423        return handle;
    424424}
     
    426426static void
    427427remove_directory_handle (DirectoryHandle  *handle)
    428428{
    429         g_static_mutex_lock (&directory_handles_lock);
     429        g_mutex_lock (&directory_handles_lock);
    430430        if (!g_hash_table_remove (directory_handles,
    431431                                  GINT_TO_POINTER (handle->id))) {
    432432                g_warning ("Couldn't remove directory handle %d\n",
    433433                           handle->id);
    434434        }
    435         g_static_mutex_unlock (&directory_handles_lock);
     435        g_mutex_unlock (&directory_handles_lock);
    436436}
    437437
    438438static DirectoryHandle *
     
    441441{
    442442        DirectoryHandle *handle;
    443443       
    444         g_static_mutex_lock (&directory_handles_lock);
     444        g_mutex_lock (&directory_handles_lock);
    445445        handle = g_hash_table_lookup (directory_handles,
    446446                                      GINT_TO_POINTER (id));
    447447        if (handle) {
    448448                handle->last_connection = conn;
    449449        }
    450         g_static_mutex_unlock (&directory_handles_lock);
     450        g_mutex_unlock (&directory_handles_lock);
    451451        return handle;
    452452}
    453453
     
    487487{
    488488        FileHandle *handle;
    489489
    490         g_static_mutex_lock (&file_handles_lock);
     490        g_mutex_lock (&file_handles_lock);
    491491        handle = file_handle_new (conn, vfs_handle, next_file_id++);
    492492
    493493        if (file_handles == NULL) {
     
    497497       
    498498        g_hash_table_insert (file_handles,
    499499                             GINT_TO_POINTER (handle->id), handle);
    500         g_static_mutex_unlock (&file_handles_lock);
     500        g_mutex_unlock (&file_handles_lock);
    501501
    502502        return handle;
    503503}
     
    505505static void
    506506remove_file_handle (FileHandle       *handle)
    507507{
    508         g_static_mutex_lock (&file_handles_lock);
     508        g_mutex_lock (&file_handles_lock);
    509509        if (!g_hash_table_remove (file_handles,
    510510                                  GINT_TO_POINTER (handle->id))) {
    511511                g_warning ("Couldn't remove file handle %d\n", handle->id);
    512512        }
    513         g_static_mutex_unlock (&file_handles_lock);
     513        g_mutex_unlock (&file_handles_lock);
    514514}
    515515
    516516static FileHandle *
     
    519519{
    520520        FileHandle *handle;
    521521
    522         g_static_mutex_lock (&file_handles_lock);
     522        g_mutex_lock (&file_handles_lock);
    523523        handle = g_hash_table_lookup (file_handles,
    524524                                      GINT_TO_POINTER (id));
    525525        if (handle) {
    526526                handle->last_connection = conn;
    527527        }
    528         g_static_mutex_unlock (&file_handles_lock);
     528        g_mutex_unlock (&file_handles_lock);
    529529       
    530530        return handle;
    531531}
  • libgnomevfs/gnome-vfs-async-job-map.c

    old new  
    2727#include <glib.h>
    2828
    2929/* job map bits guarded by this lock */
    30 static GStaticRecMutex async_job_map_lock = G_STATIC_REC_MUTEX_INIT;
     30static GRecMutex async_job_map_lock;
    3131static guint async_job_map_next_id;
    3232static int async_job_map_locked = 0;
    3333static gboolean async_job_map_shutting_down;
    3434static GHashTable *async_job_map;
    3535
    3636/* callback map bits guarded by this lock */
    37 static GStaticMutex async_job_callback_map_lock = G_STATIC_MUTEX_INIT;
     37static GMutex async_job_callback_map_lock;
    3838static GHashTable *async_job_callback_map;
    3939static guint async_job_callback_map_next_id;
    4040
     
    161161void
    162162_gnome_vfs_async_job_map_lock (void)
    163163{
    164         g_static_rec_mutex_lock (&async_job_map_lock);
     164        g_rec_mutex_lock (&async_job_map_lock);
    165165        async_job_map_locked++;
    166166}
    167167
     
    169169_gnome_vfs_async_job_map_unlock (void)
    170170{
    171171        async_job_map_locked--;
    172         g_static_rec_mutex_unlock (&async_job_map_lock);
     172        g_rec_mutex_unlock (&async_job_map_lock);
    173173}
    174174
    175175void
     
    185185{
    186186        GnomeVFSNotifyResult *notify_result;
    187187       
    188         g_static_mutex_lock (&async_job_callback_map_lock);
     188        g_mutex_lock (&async_job_callback_map_lock);
    189189       
    190190        if (async_job_callback_map == NULL) {
    191191                g_assert (async_job_map_shutting_down);
     
    199199        *valid = notify_result != NULL;
    200200        *cancelled = notify_result != NULL && notify_result->cancelled;
    201201
    202         g_static_mutex_unlock (&async_job_callback_map_lock);
     202        g_mutex_unlock (&async_job_callback_map_lock);
    203203}
    204204
    205205gboolean
     
    207207{
    208208        gboolean cancelled;
    209209
    210         g_static_mutex_lock (&async_job_callback_map_lock);
     210        g_mutex_lock (&async_job_callback_map_lock);
    211211
    212212        g_assert (!async_job_map_shutting_down);
    213213       
     
    232232                g_hash_table_insert (async_job_callback_map, GUINT_TO_POINTER (notify_result->callback_id),
    233233                        notify_result);
    234234        }
    235         g_static_mutex_unlock (&async_job_callback_map_lock);
     235        g_mutex_unlock (&async_job_callback_map_lock);
    236236       
    237237        return !cancelled;
    238238}
     
    243243        g_assert (async_job_callback_map != NULL);
    244244
    245245        JOB_DEBUG (("removing callback %d ", callback_id));
    246         g_static_mutex_lock (&async_job_callback_map_lock);
     246        g_mutex_lock (&async_job_callback_map_lock);
    247247
    248248        g_hash_table_remove (async_job_callback_map, GUINT_TO_POINTER (callback_id));
    249249
    250         g_static_mutex_unlock (&async_job_callback_map_lock);
     250        g_mutex_unlock (&async_job_callback_map_lock);
    251251}
    252252
    253253static void
     
    268268void
    269269_gnome_vfs_async_job_cancel_job_and_callbacks (GnomeVFSAsyncHandle *job_handle, GnomeVFSJob *job)
    270270{
    271         g_static_mutex_lock (&async_job_callback_map_lock);
     271        g_mutex_lock (&async_job_callback_map_lock);
    272272       
    273273        if (job != NULL) {
    274274                job->cancelled = TRUE;
     
    282282                                      callback_map_cancel_one, job_handle);
    283283        }
    284284
    285         g_static_mutex_unlock (&async_job_callback_map_lock);
     285        g_mutex_unlock (&async_job_callback_map_lock);
    286286}
    287287
    288288void
    289289async_job_callback_map_destroy (void)
    290290{
    291         g_static_mutex_lock (&async_job_callback_map_lock);
     291        g_mutex_lock (&async_job_callback_map_lock);
    292292
    293293        if (async_job_callback_map) {
    294294                g_hash_table_destroy (async_job_callback_map);
    295295                async_job_callback_map = NULL;
    296296        }
    297297
    298         g_static_mutex_unlock (&async_job_callback_map_lock);
     298        g_mutex_unlock (&async_job_callback_map_lock);
    299299}
  • libgnomevfs/gnome-vfs-daemon-method.c

    old new  
    8181static DBusHandlerResult connection_message_func      (DBusConnection  *conn,
    8282                                                       DBusMessage     *message,
    8383                                                       gpointer         data);
     84static void
     85destroy_private_connection (gpointer data)
     86{
     87        LocalConnection *ret = data;
     88
     89        dbus_connection_close (ret->connection);
     90        dbus_connection_unref (ret->connection);
     91        g_free (ret);
     92}
    8493
    85 static GStaticPrivate  local_connection_private = G_STATIC_PRIVATE_INIT;
     94static GPrivate  local_connection_private = G_PRIVATE_INIT (destroy_private_connection);
    8695
    8796
    8897static DBusObjectPathVTable connection_vtable = {
     
    343352        gchar *sender;
    344353} CancellationRequest;
    345354
    346 static void
    347 destroy_private_connection (gpointer data)
    348 {
    349         LocalConnection *ret = data;
    350 
    351         dbus_connection_close (ret->connection);
    352         dbus_connection_unref (ret->connection);
    353         g_free (ret);
    354 }
    355355
    356356static void
    357357private_connection_died (LocalConnection *connection)
    358358{
    359         g_static_private_set (&local_connection_private, NULL, NULL);
     359        g_private_set (&local_connection_private, NULL);
    360360}
    361361
    362362static LocalConnection *
     
    370370        dbus_int32_t conn_id;
    371371        LocalConnection *ret;
    372372
    373         ret = g_static_private_get (&local_connection_private);
     373        ret = g_private_get (&local_connection_private);
    374374        if (ret != NULL) {
    375375                return ret;
    376376        }
     
    438438        ret->conn_id = conn_id;
    439439        ret->handle = 0;
    440440
    441         g_static_private_set (&local_connection_private,
    442                               ret, destroy_private_connection);
     441        g_private_set (&local_connection_private,
     442                              ret);
    443443       
    444444        return ret;
    445445}
  • libgnomevfs/gnome-vfs-dbus-utils.c

    old new  
    187187        return main_dbus;
    188188}
    189189
    190 static GStaticPrivate  daemon_connection_private = G_STATIC_PRIVATE_INIT;
     190static GPrivate  daemon_connection_private;
    191191
    192192DBusConnection *
    193193_gnome_vfs_daemon_get_current_connection (void)
    194194{
    195         return g_static_private_get (&daemon_connection_private);
     195        return g_private_get (&daemon_connection_private);
    196196}
    197197
    198198void
    199199gnome_vfs_daemon_set_current_connection (DBusConnection *conn)
    200200{
    201         g_static_private_set (&daemon_connection_private, conn, NULL);
     201        g_private_set (&daemon_connection_private, conn);
    202202}
  • libgnomevfs/gnome-vfs-file-info.c

    old new  
    3131/* Mutex for making GnomeVFSFileInfo ref's/unref's atomic */
    3232/* Note that an atomic increment function (such as is present in NSPR) is preferable */
    3333/* FIXME: This mutex is probably not needed and might be causing performance issues */
    34 static GStaticMutex file_info_ref_lock = G_STATIC_MUTEX_INIT;
     34static GMutex file_info_ref_lock;
    3535
    3636/* Register GnomeVFSFileInfo in the type system */
    3737GType
     
    8383        g_return_if_fail (info != NULL);
    8484        g_return_if_fail (info->refcount > 0);
    8585
    86         g_static_mutex_lock (&file_info_ref_lock);
     86        g_mutex_lock (&file_info_ref_lock);
    8787        info->refcount += 1;
    88         g_static_mutex_unlock (&file_info_ref_lock);
     88        g_mutex_unlock (&file_info_ref_lock);
    8989       
    9090}
    9191
     
    101101        g_return_if_fail (info != NULL);
    102102        g_return_if_fail (info->refcount > 0);
    103103
    104         g_static_mutex_lock (&file_info_ref_lock);
     104        g_mutex_lock (&file_info_ref_lock);
    105105        info->refcount -= 1;
    106         g_static_mutex_unlock (&file_info_ref_lock);
     106        g_mutex_unlock (&file_info_ref_lock);
    107107
    108108        if (info->refcount == 0) {
    109109                gnome_vfs_file_info_clear (info);
     
    133133        g_free (info->selinux_context);
    134134
    135135        /* Ensure the ref count is maintained correctly */
    136         g_static_mutex_lock (&file_info_ref_lock);
     136        g_mutex_lock (&file_info_ref_lock);
    137137
    138138        old_refcount = info->refcount;
    139139        memset (info, 0, sizeof (*info));
    140140        info->refcount = old_refcount;
    141141
    142         g_static_mutex_unlock (&file_info_ref_lock);
     142        g_mutex_unlock (&file_info_ref_lock);
    143143}
    144144
    145145
     
    182182         * want serialize access differently (or perhaps you shouldn't
    183183         * use copy)
    184184         */
    185         g_static_mutex_lock (&file_info_ref_lock);
     185        g_mutex_lock (&file_info_ref_lock);
    186186
    187187        old_refcount = dest->refcount;
    188188
     
    199199
    200200        dest->refcount = old_refcount;
    201201
    202         g_static_mutex_unlock (&file_info_ref_lock);
     202        g_mutex_unlock (&file_info_ref_lock);
    203203
    204204}
    205205
  • libgnomevfs/gnome-vfs-init.c

    old new  
    122122                return FALSE;
    123123        }
    124124
    125         if (!g_thread_supported ())
    126                 g_thread_init (NULL);
    127125
    128126        G_LOCK (vfs_already_initialized);
    129127
     
    235233gboolean
    236234gnome_vfs_is_primary_thread (void)
    237235{
    238         if (g_thread_supported()) {
    239                 return GPOINTER_TO_UINT(g_private_get (private_is_primary_thread)) == 1;
    240         } else {
    241                 return TRUE;
    242         }
     236        return GPOINTER_TO_UINT(g_private_get (private_is_primary_thread)) == 1;
    243237}
  • libgnomevfs/gnome-vfs-job.c

    old new  
    4343#include <string.h>
    4444#include <unistd.h>
    4545
    46 static GStaticPrivate job_private = G_STATIC_PRIVATE_INIT;
     46static GPrivate job_private;
    4747
    4848#if GNOME_VFS_JOB_DEBUG
    4949
     
    6464 * Since this id debug only, just use what the macro should be here.
    6565 * even though it is not portable.
    6666 */
    67 GStaticMutex debug_mutex = G_STATIC_MUTEX_INIT;
     67GMutex debug_mutex;
    6868#endif
    6969
    7070static int job_count = 0;
     
    17341734set_current_job (GnomeVFSJob *job)
    17351735{
    17361736        /* There shouldn't have been anything here. */
    1737         g_assert (g_static_private_get (&job_private) == NULL);
     1737        g_assert (g_private_get (&job_private) == NULL);
    17381738
    1739         g_static_private_set (&job_private, job, NULL);
     1739        g_private_set (&job_private, job);
    17401740
    17411741        _gnome_vfs_module_callback_use_stack_info (job->op->stack_info);
    17421742        _gnome_vfs_module_callback_set_in_async_thread (TRUE);
     
    17451745static void
    17461746clear_current_job (void)
    17471747{
    1748         g_static_private_set (&job_private, NULL, NULL);
     1748        g_private_set (&job_private, NULL);
    17491749
    17501750        _gnome_vfs_module_callback_clear_stacks ();
    17511751}
     
    17571757       
    17581758        g_return_if_fail (context != NULL);
    17591759
    1760         job = g_static_private_get (&job_private);
     1760        job = g_private_get (&job_private);
    17611761
    17621762        if (job != NULL) {
    17631763                *context = job->op->context;
     
    17771777        GnomeVFSJob *job;
    17781778        GnomeVFSNotifyResult notify_result;
    17791779
    1780         job = g_static_private_get (&job_private);
     1780        job = g_private_get (&job_private);
    17811781
    17821782        g_return_if_fail (job != NULL);
    17831783
  • libgnomevfs/gnome-vfs-method.c

    old new  
    6363
    6464static GHashTable *module_hash = NULL;
    6565G_LOCK_DEFINE_STATIC (gnome_vfs_method_init);
    66 static GStaticRecMutex module_hash_lock = G_STATIC_REC_MUTEX_INIT;
     66static GRecMutex module_hash_lock;
    6767
    6868static GList *module_path_list = NULL;
    6969
     
    343343        const char *args;
    344344        gboolean run_in_daemon;
    345345
    346         g_static_rec_mutex_lock (&module_hash_lock);
     346        g_rec_mutex_lock (&module_hash_lock);
    347347
    348348        module_element = g_hash_table_lookup (module_hash, name);
    349349
     
    408408        g_hash_table_insert (module_hash, module_element->name, module_element);
    409409
    410410 add_module_out:
    411         g_static_rec_mutex_unlock (&module_hash_lock);
     411        g_rec_mutex_unlock (&module_hash_lock);
    412412
    413413        return module_element;
    414414}
  • libgnomevfs/gnome-vfs-module-callback.c

    old new  
    5959
    6060/* -- Global variables -- */
    6161
    62 static GStaticMutex callback_table_lock = G_STATIC_MUTEX_INIT;
     62static GMutex callback_table_lock;
    6363static GHashTable *default_callbacks = NULL;
    6464static GHashTable *default_async_callbacks = NULL;
    6565static GHashTable *stack_tables_to_free = NULL;
     
    6969static GPrivate *in_async_thread_key;
    7070
    7171static GCond *async_callback_cond;
    72 static GStaticMutex async_callback_lock = G_STATIC_MUTEX_INIT;
     72static GMutex async_callback_lock;
    7373
    7474/* -- Helper functions -- */
    7575
     
    120120{
    121121        CallbackResponseData *response_data;
    122122
    123         g_static_mutex_lock (&async_callback_lock);
     123        g_mutex_lock (&async_callback_lock);
    124124        response_data = data;
    125125        response_data->done = TRUE;
    126126        g_cond_broadcast (async_callback_cond);
    127127
    128         g_static_mutex_unlock (&async_callback_lock);
     128        g_mutex_unlock (&async_callback_lock);
    129129}
    130130
    131131static void
     
    146146         * new mutexes and condition variables all the time.
    147147         */
    148148
    149         g_static_mutex_lock (&async_callback_lock);
     149        g_mutex_lock (&async_callback_lock);
    150150        response_data.done = FALSE;
    151151        _gnome_vfs_dispatch_module_callback (async_callback->callback,
    152152                                            in, in_size,
     
    156156                                            &response_data);
    157157        while (!response_data.done) {
    158158                g_cond_wait (async_callback_cond,
    159                              g_static_mutex_get_mutex (&async_callback_lock));
     159                             &async_callback_lock);
    160160        }
    161161
    162         g_static_mutex_unlock (&async_callback_lock);
     162        g_mutex_unlock (&async_callback_lock);
    163163}
    164164
    165165static void
     
    410410
    411411        stack_table = specific;
    412412
    413         g_static_mutex_lock (&callback_table_lock);
     413        g_mutex_lock (&callback_table_lock);
    414414        if (stack_tables_to_free != NULL) {
    415415                g_hash_table_remove (stack_tables_to_free, stack_table);
    416416        } else {
    417417                stack_table = NULL;
    418418        }
    419         g_static_mutex_unlock (&callback_table_lock);
     419        g_mutex_unlock (&callback_table_lock);
    420420
    421421        if (stack_table) {
    422422                clear_stack_table (stack_table);
     
    443443static void
    444444free_stack_tables_to_free (void)
    445445{
    446         g_static_mutex_lock (&callback_table_lock);
     446        g_mutex_lock (&callback_table_lock);
    447447        g_hash_table_foreach_remove (stack_tables_to_free, stack_table_free_hr_func , NULL);
    448448        g_hash_table_destroy (stack_tables_to_free);
    449449        stack_tables_to_free = NULL;
    450         g_static_mutex_unlock (&callback_table_lock);
     450        g_mutex_unlock (&callback_table_lock);
    451451}
    452452
    453453void
     
    461461
    462462        async_callback_cond = g_cond_new ();
    463463
    464         g_atexit (free_stack_tables_to_free);   
     464        atexit (free_stack_tables_to_free);     
    465465}
    466466
    467467static void
    468468free_default_callbacks (void)
    469469{
    470         g_static_mutex_lock (&callback_table_lock);
     470        g_mutex_lock (&callback_table_lock);
    471471
    472472        clear_callback_table (default_callbacks);
    473473        g_hash_table_destroy (default_callbacks);
     
    475475        clear_callback_table (default_async_callbacks);
    476476        g_hash_table_destroy (default_async_callbacks);
    477477
    478         g_static_mutex_unlock (&callback_table_lock);
     478        g_mutex_unlock (&callback_table_lock);
    479479}
    480480
    481481/* This function should only be called with the mutex held. */
     
    486486                default_callbacks = g_hash_table_new (g_str_hash, g_str_equal);
    487487                default_async_callbacks = g_hash_table_new (g_str_hash, g_str_equal);
    488488
    489                 g_atexit (free_default_callbacks);
     489                atexit (free_default_callbacks);
    490490        }
    491491}
    492492
     
    496496{
    497497        /* Initialize per-thread data, if needed. */
    498498        if (g_private_get (callback_stacks_key) == NULL) {
    499                 g_static_mutex_lock (&callback_table_lock);
     499                g_mutex_lock (&callback_table_lock);
    500500                g_private_set (callback_stacks_key,
    501501                                     g_hash_table_new (g_str_hash, g_str_equal));
    502502                g_hash_table_insert (stack_tables_to_free,
    503503                                     g_private_get (callback_stacks_key),
    504504                                     GINT_TO_POINTER (1));
    505                 g_static_mutex_unlock (&callback_table_lock);
     505                g_mutex_unlock (&callback_table_lock);
    506506        }
    507507
    508508        if (g_private_get (async_callback_stacks_key) == NULL) {
    509                 g_static_mutex_lock (&callback_table_lock);
     509                g_mutex_lock (&callback_table_lock);
    510510                g_private_set (async_callback_stacks_key,
    511511                                     g_hash_table_new (g_str_hash, g_str_equal));
    512512                g_hash_table_insert (stack_tables_to_free,
    513513                                     g_private_get (async_callback_stacks_key),
    514514                                     GINT_TO_POINTER (1));
    515                 g_static_mutex_unlock (&callback_table_lock);
     515                g_mutex_unlock (&callback_table_lock);
    516516        }
    517517}
    518518
     
    618618
    619619        callback_info = callback_info_new (callback, callback_data, destroy_notify);
    620620
    621         g_static_mutex_lock (&callback_table_lock);
     621        g_mutex_lock (&callback_table_lock);
    622622
    623623        initialize_global_if_needed ();
    624624        insert_callback_into_table (default_callbacks, callback_name, callback_info);
    625625
    626         g_static_mutex_unlock (&callback_table_lock);
     626        g_mutex_unlock (&callback_table_lock);
    627627
    628628        callback_info_unref (callback_info);
    629629}
     
    730730
    731731        callback_info = async_callback_info_new (callback, callback_data, notify);
    732732
    733         g_static_mutex_lock (&callback_table_lock);
     733        g_mutex_lock (&callback_table_lock);
    734734
    735735        initialize_global_if_needed ();
    736736        insert_callback_into_table (default_async_callbacks, callback_name, callback_info);
    737737
    738         g_static_mutex_unlock (&callback_table_lock);
     738        g_mutex_unlock (&callback_table_lock);
    739739
    740740        callback_info_unref (callback_info);
    741741}
     
    864864                        g_assert (callback != NULL);
    865865                        callback_info_ref (callback);
    866866                } else {
    867                         g_static_mutex_lock (&callback_table_lock);
     867                        g_mutex_lock (&callback_table_lock);
    868868                        initialize_global_if_needed ();
    869869                        callback = g_hash_table_lookup (default_async_callbacks, callback_name);
    870870                        if (callback != NULL) {
    871871                                callback_info_ref (callback);
    872872                        }
    873                         g_static_mutex_unlock (&callback_table_lock);
     873                        g_mutex_unlock (&callback_table_lock);
    874874                }
    875875        }
    876876
     
    883883                        g_assert (callback != NULL);
    884884                        callback_info_ref (callback);
    885885                } else {
    886                         g_static_mutex_lock (&callback_table_lock);
     886                        g_mutex_lock (&callback_table_lock);
    887887                        initialize_global_if_needed ();
    888888                        callback = g_hash_table_lookup (default_callbacks, callback_name);
    889889                        if (callback != NULL) {
    890890                                callback_info_ref (callback);
    891891                        }
    892                         g_static_mutex_unlock (&callback_table_lock);
     892                        g_mutex_unlock (&callback_table_lock);
    893893                }
    894894        }
    895895
     
    920920        stack_info->current_callbacks = g_hash_table_new (g_str_hash, g_str_equal);
    921921        stack_info->current_async_callbacks = g_hash_table_new (g_str_hash, g_str_equal);
    922922
    923         g_static_mutex_lock (&callback_table_lock);
     923        g_mutex_lock (&callback_table_lock);
    924924        initialize_global_if_needed ();
    925         g_static_mutex_unlock (&callback_table_lock);
     925        g_mutex_unlock (&callback_table_lock);
    926926
    927927        initialize_per_thread_if_needed ();
    928928        copy_callback_stack_tops (g_private_get (callback_stacks_key),
  • libgnomevfs/gnome-vfs-resolve.c

    old new  
    139139restart_resolve (void)
    140140{
    141141           static GTimeVal last_reload = { 0, 0 };
    142            static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
     142           static GMutex mutex;
    143143           GTimeVal now;
    144144           gboolean ret;
    145145
    146            g_static_mutex_lock (&mutex);
     146           g_mutex_lock (&mutex);
    147147           g_get_current_time (&now);
    148148           
    149149           if ((now.tv_sec - last_reload.tv_sec) > RELOAD_TIMEVAL) {
     
    155155                         ret = FALSE;
    156156           }
    157157       
    158            g_static_mutex_unlock (&mutex);
     158           g_mutex_unlock (&mutex);
    159159           return ret;
    160160}
    161161#else
  • modules/sftp-method.c

    old new  
    14881488                        invoke_save_auth (uri, keyring, user_name, object, authtype, password);
    14891489                }
    14901490
    1491                 if (!g_thread_supported ()) g_thread_init (NULL);
    1492 
    14931491                *connection = g_new0 (SftpConnection, 1);
    14941492                (*connection)->ref_count = 1;
    14951493                (*connection)->in_fd = in_fd;