diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-09-20 13:22:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-09-20 13:22:53 (GMT) |
commit | f7c1c34cb54b239586bf431b1749759baee9493e (patch) | |
tree | 24b2954e45202bcc36f60166112a23acf931be1f /src/glibext/delayed-int.h | |
parent | 859bdb6b51d76058eb1a8bfa619a15978f50b251 (diff) |
Rewritten the work queue and fixed thread concurrency.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@117 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/glibext/delayed-int.h')
-rw-r--r-- | src/glibext/delayed-int.h | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/src/glibext/delayed-int.h b/src/glibext/delayed-int.h index 7fb8f3a..b2e2b23 100644 --- a/src/glibext/delayed-int.h +++ b/src/glibext/delayed-int.h @@ -25,12 +25,17 @@ #include "../common/dllist.h" +#include "../gtkext/gtkextstatusbar.h" /* -------------------------- TACHE DIFFEREE DANS LE TEMPS -------------------------- */ +/* Traite un travail programmé. */ +typedef void (* run_task_fc) (GDelayedWork *, GtkExtStatusBar *); + + /* Travail différé (instance) */ struct _GDelayedWork { @@ -38,6 +43,8 @@ struct _GDelayedWork DL_LIST_ITEM(link); /* Lien vers les maillons */ + run_task_fc run; /* Traitement externalisé */ + }; /* Travail différé (classe) */ @@ -45,38 +52,12 @@ struct _GDelayedWorkClass { GObjectClass parent; /* A laisser en premier */ -}; - - -#define delayed_work_list_add_tail(new, head) dl_list_add_tail(new, head, GDelayedWork, link) -#define delayed_work_list_del(item, head) dl_list_del(item, head, GDelayedWork, link) - - - -/* ------------------------- TRAITEMENT DE TACHES DIFFEREES ------------------------- */ - + /* Signaux */ -/* Effectue le traitement d'une tâche donnée. */ -typedef void (* process_work_fc) (GWorkQueue *, GDelayedWork *); - - -/* Gestionnaire des travaux différés (instance) */ -struct _GWorkQueue -{ - GObject parent; /* A laisser en premier */ - - GDelayedWork *works; /* Tâches à mener à bien */ - GMutex *mutex; /* Verrou pour l'accès */ - GCond *cond; /* Réveil pour un traitement */ - - GThread *thread; /* Procédure de traitement */ - process_work_fc process; /* Coeur du traitement */ + void (* work_completed) (GDelayedWork *); }; -/* Gestionnaire des travaux différés (classe) */ -struct _GWorkQueueClass -{ - GObjectClass parent; /* A laisser en premier */ -}; +#define delayed_work_list_add_tail(new, head) dl_list_add_tail(new, head, GDelayedWork, link) +#define delayed_work_list_del(item, head) dl_list_del(item, head, GDelayedWork, link) |