This example shows how an Ecore_Job can be added, how it can be deleted, and that they always execute in the added order.
First, 2 callback functions are declared, one that prints strings passed to it in the data pointer, and another one that quits the main loop. In the main function, 3 jobs are added using the first callback, and another one is added using the second one.
Then the second added job is deleted just to demonstrate the usage of ecore_job_del(), and the main loop is finally started. Run this example to see that job1, job3 and job_quit are ran, in this order.
 
#include <Ecore.h>
#include <unistd.h>
 
static void
_job_print_cb(void *data)
{
   char *str = data;
 
   printf("%s\n", str);
}
 
static void
{
}
 
int
main(void)
{
   char *str1 = "Job 1 started.";
   char *str2 = "Job 2 started.";
   char *str3 = "Job 3 started.";
 
     {
        printf("ERROR: Cannot init Ecore!\n");
        return -1;
     }
 
 
 
   (void)job1;
   (void)job3;
   (void)job_quit;
 
   printf("Created jobs 1, 2, 3 and quit.\n");
 
   if (job2)
     {
        char *str;
        job2 = NULL;
        printf("Deleted job 2. Its data was: \"%s\"\n", str);
     }
 
 
   return 0;
}
 
EAPI int ecore_shutdown(void)
Shuts down connections, signal handlers sockets etc.
Definition: ecore.c:366
EAPI int ecore_init(void)
Sets up connections, signal handlers, sockets etc.
Definition: ecore.c:225
Ecore_Job * ecore_job_add(Ecore_Cb func, const void *data)
Adds a job to the event queue.
Definition: ecore_job.c:43
void * ecore_job_del(Ecore_Job *job)
Deletes a queued job that has not yet been executed.
Definition: ecore_job.c:73
struct _Ecore_Job Ecore_Job
A job handle.
Definition: Ecore_Common.h:3207
void ecore_main_loop_quit(void)
Quits the main loop once all the events currently on the queue have been processed.
Definition: ecore_main.c:1308
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1298
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339