Enlightenment CVS committal Author : raster Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_job Modified Files: Ecore_Job.h ecore_job.c Log Message: cedric's ecore_job_init/shtudown patches. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_job/Ecore_Job.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- Ecore_Job.h 15 Mar 2007 22:21:27 -0000 1.8 +++ Ecore_Job.h 5 Oct 2007 05:12:37 -0000 1.9 @@ -35,6 +35,8 @@ typedef void Ecore_Job; /**< A job handle */ #endif +EAPI int ecore_job_init(); +EAPI int ecore_job_shutdown(); EAPI Ecore_Job *ecore_job_add(void (*func) (void *data), const void *data); EAPI void *ecore_job_del(Ecore_Job *job); =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_job/ecore_job.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- ecore_job.c 6 Jan 2006 18:05:08 -0000 1.8 +++ ecore_job.c 5 Oct 2007 05:12:37 -0000 1.9 @@ -7,6 +7,34 @@ static void _ecore_job_event_free(void *data, void *ev); static int ecore_event_job_type = 0; +static int _ecore_init_job_count = 0; +static Ecore_Event_Handler* _ecore_job_handler = NULL; + +EAPI int +ecore_job_init() +{ + if (++_ecore_init_job_count == 1) + { + ecore_init(); + ecore_event_job_type = ecore_event_type_new(); + _ecore_job_handler = ecore_event_handler_add(ecore_event_job_type, _ecore_job_event_handler, NULL); + } + + return _ecore_init_job_count; +} + +EAPI int +ecore_job_shutdown() +{ + if (--_ecore_init_job_count) + return _ecore_init_job_count; + + ecore_event_handler_del(_ecore_job_handler); + _ecore_job_handler = NULL; + ecore_shutdown(); + + return _ecore_init_job_count; +} /** * Add a job to the event queue. @@ -24,11 +52,7 @@ Ecore_Job *job; if (!func) return NULL; - if (!ecore_event_job_type) - { - ecore_event_job_type = ecore_event_type_new(); - ecore_event_handler_add(ecore_event_job_type, _ecore_job_event_handler, NULL); - } + job = calloc(1, sizeof(Ecore_Job)); if (!job) return NULL; ECORE_MAGIC_SET(job, ECORE_MAGIC_JOB); ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs