diff options
author | nobody <nobody@localhost> | 2002-05-16 00:19:25 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2002-05-16 00:19:25 +0800 |
commit | acdd664f5104862243db8c3a0689d5ac4ede774e (patch) | |
tree | 9a14849dd3a40bd1667b88d689e2aa7d58d08bce /calendar/pcs/job.c | |
parent | 74f4231f4eb650f0243ff39ab5a085b1df4f7697 (diff) | |
download | gsoc2013-evolution-GNOME_UTILS_2_0_2.tar gsoc2013-evolution-GNOME_UTILS_2_0_2.tar.gz gsoc2013-evolution-GNOME_UTILS_2_0_2.tar.bz2 gsoc2013-evolution-GNOME_UTILS_2_0_2.tar.lz gsoc2013-evolution-GNOME_UTILS_2_0_2.tar.xz gsoc2013-evolution-GNOME_UTILS_2_0_2.tar.zst gsoc2013-evolution-GNOME_UTILS_2_0_2.zip |
This commit was manufactured by cvs2svn to create tagGNOME_UTILS_2_0_2
'GNOME_UTILS_2_0_2'.
svn path=/tags/GNOME_UTILS_2_0_2/; revision=16870
Diffstat (limited to 'calendar/pcs/job.c')
-rw-r--r-- | calendar/pcs/job.c | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/calendar/pcs/job.c b/calendar/pcs/job.c deleted file mode 100644 index 584f1a6f38..0000000000 --- a/calendar/pcs/job.c +++ /dev/null @@ -1,98 +0,0 @@ -/* GNOME personal calendar server - job manager - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include "job.h" - - - -/* The job list */ - -typedef struct { - JobFunc func; - gpointer data; -} Job; - -static GSList *jobs_head; -static GSList *jobs_tail; - -static guint jobs_idle_id; - - - -/* Runs a job and dequeues it */ -static gboolean -run_job (gpointer data) -{ - Job *job; - GSList *l; - - g_assert (jobs_head != NULL); - - job = jobs_head->data; - (* job->func) (job->data); - g_free (job); - - l = jobs_head; - jobs_head = g_slist_remove_link (jobs_head, jobs_head); - g_slist_free_1 (l); - - if (!jobs_head) { - jobs_tail = NULL; - jobs_idle_id = 0; - return FALSE; - } else - return TRUE; -} - -/** - * job_add: - * @func: Function to run the job. - * @data: Data to pass to @function. - * - * Adds a job to the queue. The job will automatically be run asynchronously. - **/ -void -job_add (JobFunc func, gpointer data) -{ - Job *job; - - g_return_if_fail (func != NULL); - - job = g_new (Job, 1); - job->func = func; - job->data = data; - - if (!jobs_head) { - g_assert (jobs_tail == NULL); - g_assert (jobs_idle_id == 0); - - jobs_head = g_slist_append (NULL, job); - jobs_tail = jobs_head; - - jobs_idle_id = g_idle_add (run_job, NULL); - } else { - g_assert (jobs_tail != NULL); - g_assert (jobs_idle_id != 0); - - jobs_tail = g_slist_append (jobs_tail, job)->next; - } -} |