summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-file-changes-queue.c
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-07-06 23:16:48 +0200
committerraveit65 <[email protected]>2016-07-11 12:53:14 +0200
commit80d463a721ce9191efdada8f1b041baea1af1643 (patch)
tree697e5c281256716e2526260655a2910e3f515da7 /libcaja-private/caja-file-changes-queue.c
parentd866d7a3a5b778cbd413eaa67ad69c80e9277c6b (diff)
downloadcaja-80d463a721ce9191efdada8f1b041baea1af1643.tar.bz2
caja-80d463a721ce9191efdada8f1b041baea1af1643.tar.xz
all: don't use deprecated GMutex/GThread API
Also, threads area always enabled, so we can remove the G_THREADS_ENABLED conditionals. Require GLib 2.31 for this. taken from: https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-4&id=0594aa1 Note, this fixes a Wimplicit-function-declaration warning in caja-search-engine-simple
Diffstat (limited to 'libcaja-private/caja-file-changes-queue.c')
-rw-r--r--libcaja-private/caja-file-changes-queue.c65
1 files changed, 5 insertions, 60 deletions
diff --git a/libcaja-private/caja-file-changes-queue.c b/libcaja-private/caja-file-changes-queue.c
index 8b60d63a..58f11ad4 100644
--- a/libcaja-private/caja-file-changes-queue.c
+++ b/libcaja-private/caja-file-changes-queue.c
@@ -25,14 +25,6 @@
#include "caja-directory-notify.h"
-#ifdef G_THREADS_ENABLED
-#define MUTEX_LOCK(a) if ((a) != NULL) g_mutex_lock (a)
-#define MUTEX_UNLOCK(a) if ((a) != NULL) g_mutex_unlock (a)
-#else
-#define MUTEX_LOCK(a)
-#define MUTEX_UNLOCK(a)
-#endif
-
typedef enum
{
CHANGE_FILE_INITIAL,
@@ -57,9 +49,7 @@ typedef struct
{
GList *head;
GList *tail;
-#ifdef G_THREADS_ENABLED
GMutex mutex;
-#endif
} CajaFileChangesQueue;
static CajaFileChangesQueue *
@@ -69,9 +59,8 @@ caja_file_changes_queue_new (void)
result = g_new0 (CajaFileChangesQueue, 1);
-#ifdef G_THREADS_ENABLED
g_mutex_init (&result->mutex);
-#endif
+
return result;
}
@@ -88,62 +77,18 @@ caja_file_changes_queue_get (void)
return file_changes_queue;
}
-#if 0 /* no public free call yet */
-
-static void
-caja_file_change_free (CajaFileChange *change)
-{
- if (change->from)
- {
- g_object_unref (change->from);
- }
- if (change->to)
- {
- g_object_unref (change->to);
- }
-}
-
-void
-caja_file_changes_queue_free (CajaFileChangesQueue *queue)
-{
- GList *p;
- if (queue == NULL)
- {
- return;
- }
-
-#ifdef G_THREADS_ENABLED
- /* if lock on a defunct mutex were defined (returning a failure)
- * we would lock here
- */
-#endif
-
- for (p = queue->head; p != NULL; p = p->next)
- {
- caja_file_change_free (p->data);
- }
- g_list_free (queue->head);
-
-#ifdef G_THREADS_ENABLED
- g_mutex_clear (&queue->mutex);
-#endif
- g_free (queue);
-}
-
-#endif /* no public free call yet */
-
static void
caja_file_changes_queue_add_common (CajaFileChangesQueue *queue,
CajaFileChange *new_item)
{
/* enqueue the new queue item while locking down the list */
- MUTEX_LOCK (&queue->mutex);
+ g_mutex_lock (&queue->mutex);
queue->head = g_list_prepend (queue->head, new_item);
if (queue->tail == NULL)
queue->tail = queue->head;
- MUTEX_UNLOCK (&queue->mutex);
+ g_mutex_unlock (&queue->mutex);
}
void
@@ -245,7 +190,7 @@ caja_file_changes_queue_get_change (CajaFileChangesQueue *queue)
g_assert (queue != NULL);
/* dequeue the tail item while locking down the list */
- MUTEX_LOCK (&queue->mutex);
+ g_mutex_lock (&queue->mutex);
if (queue->tail == NULL)
{
@@ -261,7 +206,7 @@ caja_file_changes_queue_get_change (CajaFileChangesQueue *queue)
queue->tail = new_tail;
}
- MUTEX_UNLOCK (&queue->mutex);
+ g_mutex_unlock (&queue->mutex);
return result;
}