cedric's ecore_job_init/shtudown patches.

SVN revision: 31972
This commit is contained in:
Carsten Haitzler 2007-10-05 05:12:38 +00:00
parent bb28443e9a
commit cf49928045
5 changed files with 50 additions and 6 deletions

View File

@ -35,6 +35,8 @@ extern "C" {
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);

View File

@ -7,6 +7,34 @@ static int _ecore_job_event_handler(void *data, int type, void *ev);
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_add(void (*func) (void *data), const void *data)
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);

View File

@ -4,6 +4,8 @@
#include <time.h>
#include <Ecore_Job.h>
#include "Edje.h"
#include "edje_private.h"
@ -21,6 +23,7 @@ edje_init(void)
initted++;
if (initted == 1)
{
ecore_job_init();
srand(time(NULL));
_edje_edd_setup();
_edje_text_init();
@ -40,6 +43,10 @@ edje_shutdown(void)
initted--;
if (initted > 0) return initted;
if (_edje_timer)
ecore_animator_del(_edje_timer);
_edje_timer = NULL;
_edje_file_cache_shutdown();
_edje_message_shutdown();
_edje_edd_free();
@ -48,7 +55,8 @@ edje_shutdown(void)
_edje_text_class_members_free();
_edje_text_class_hash_free();
embryo_shutdown();
ecore_job_shutdown();
return 0;
}

View File

@ -124,7 +124,12 @@ void
_edje_message_shutdown(void)
{
_edje_message_queue_clear();
if (job_loss_timer)
ecore_timer_del(job_loss_timer);
if (job)
ecore_job_del(job);
job = NULL;
job_loss_timer = NULL;
}
void

View File

@ -193,12 +193,15 @@ emotion_object_init(Evas_Object *obj, const char *module_filename)
sd->seek_pos = 0;
sd->len = 0;
ecore_job_init();
if ((!sd->module) || (!sd->video))
{
if (!_emotion_module_open(module_filename, obj,
&sd->module, &sd->video))
return 0;
}
return 1;
}
@ -1183,6 +1186,8 @@ _smart_del(Evas_Object * obj)
if (sd->progress.info) free(sd->progress.info);
if (sd->ref.file) free(sd->ref.file);
free(sd);
ecore_job_shutdown();
}
static void