summaryrefslogtreecommitdiff
path: root/libview/ev-job-scheduler.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-05-17 05:15:56 +0200
committerinfirit <[email protected]>2014-09-23 13:31:02 +0200
commit94dcb761b95ee54ef1f1512d59721932d75ffb7f (patch)
tree60f89e8174ffc3133c0f1758e2f43408b510c02b /libview/ev-job-scheduler.c
parent53bb92a83092a70170f85d75491c5b0b881455bc (diff)
downloadatril-94dcb761b95ee54ef1f1512d59721932d75ffb7f.tar.bz2
atril-94dcb761b95ee54ef1f1512d59721932d75ffb7f.tar.xz
Fix glib deprecations
Based on evince commit by Carlos Garcia Campos <[email protected]> Url: https://git.gnome.org/browse/evince/commit/?id=bf90f90e0af99bbfdd20e6d21fd228c05cffae51 Url: https://git.gnome.org/browse/evince/commit/?id=76151be92239ed5f491cb26c87a2328b670e9f64
Diffstat (limited to 'libview/ev-job-scheduler.c')
-rw-r--r--libview/ev-job-scheduler.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/libview/ev-job-scheduler.c b/libview/ev-job-scheduler.c
index 9d028b0a..4cb6864c 100644
--- a/libview/ev-job-scheduler.c
+++ b/libview/ev-job-scheduler.c
@@ -40,8 +40,8 @@ static GQueue queue_high = G_QUEUE_INIT;
static GQueue queue_low = G_QUEUE_INIT;
static GQueue queue_none = G_QUEUE_INIT;
-static GCond *job_queue_cond = NULL;
-static GMutex *job_queue_mutex = NULL;
+static GCond job_queue_cond;
+static GMutex job_queue_mutex;
static GQueue *job_queue[EV_JOB_N_PRIORITIES] = {
&queue_urgent,
&queue_high,
@@ -55,12 +55,12 @@ ev_job_queue_push (EvSchedulerJob *job,
{
ev_debug_message (DEBUG_JOBS, "%s priority %d", EV_GET_TYPE_NAME (job->job), priority);
- g_mutex_lock (job_queue_mutex);
+ g_mutex_lock (&job_queue_mutex);
g_queue_push_tail (job_queue[priority], job);
- g_cond_broadcast (job_queue_cond);
+ g_cond_broadcast (&job_queue_cond);
- g_mutex_unlock (job_queue_mutex);
+ g_mutex_unlock (&job_queue_mutex);
}
static EvSchedulerJob *
@@ -83,9 +83,7 @@ ev_job_queue_get_next_unlocked (void)
static gpointer
ev_job_scheduler_init (gpointer data)
{
- job_queue_cond = g_cond_new ();
- job_queue_mutex = g_mutex_new ();
- g_thread_create (ev_job_thread_proxy, NULL, FALSE, NULL);
+ g_thread_new ("EvJobScheduler", ev_job_thread_proxy, NULL);
return NULL;
}
@@ -152,7 +150,7 @@ ev_scheduler_thread_job_cancelled (EvSchedulerJob *job,
ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job));
- g_mutex_lock (job_queue_mutex);
+ g_mutex_lock (&job_queue_mutex);
/* If the job is not still running,
* remove it from the job queue and job list.
@@ -162,10 +160,10 @@ ev_scheduler_thread_job_cancelled (EvSchedulerJob *job,
list = g_queue_find (job_queue[job->priority], job);
if (list) {
g_queue_delete_link (job_queue[job->priority], list);
- g_mutex_unlock (job_queue_mutex);
+ g_mutex_unlock (&job_queue_mutex);
ev_scheduler_job_destroy (job);
} else {
- g_mutex_unlock (job_queue_mutex);
+ g_mutex_unlock (&job_queue_mutex);
}
}
@@ -201,14 +199,14 @@ ev_job_thread_proxy (gpointer data)
while (TRUE) {
EvSchedulerJob *job;
- g_mutex_lock (job_queue_mutex);
+ g_mutex_lock (&job_queue_mutex);
job = ev_job_queue_get_next_unlocked ();
if (!job) {
- g_cond_wait (job_queue_cond, job_queue_mutex);
- g_mutex_unlock (job_queue_mutex);
+ g_cond_wait (&job_queue_cond, &job_queue_mutex);
+ g_mutex_unlock (&job_queue_mutex);
continue;
}
- g_mutex_unlock (job_queue_mutex);
+ g_mutex_unlock (&job_queue_mutex);
ev_job_thread (job->job);
ev_scheduler_job_destroy (job);
@@ -288,7 +286,7 @@ ev_job_scheduler_update_job (EvJob *job,
if (need_resort) {
GList *list;
- g_mutex_lock (job_queue_mutex);
+ g_mutex_lock (&job_queue_mutex);
list = g_queue_find (job_queue[s_job->priority], s_job);
if (list) {
@@ -296,10 +294,10 @@ ev_job_scheduler_update_job (EvJob *job,
EV_GET_TYPE_NAME (job), s_job->priority, priority);
g_queue_delete_link (job_queue[s_job->priority], list);
g_queue_push_tail (job_queue[priority], s_job);
- g_cond_broadcast (job_queue_cond);
+ g_cond_broadcast (&job_queue_cond);
}
- g_mutex_unlock (job_queue_mutex);
+ g_mutex_unlock (&job_queue_mutex);
}
}