88 g_async_queue_push(event_loop->
queue, e);
115 #if GLIB_MAJOR_VERSION >= 2 && GLIB_MINOR_VERSION >= 32 116 if((ret = g_async_queue_timeout_pop(event_loop->
queue,
117 timeout.tv_sec * 1000000 + timeout.tv_usec)) == NULL)
120 g_get_current_time(&timeout);
121 g_time_val_add(&timeout, 1000000);
122 if((ret = g_async_queue_timed_pop(event_loop->
queue, &timeout)) == NULL)
126 if(ret->
func == NULL)
208 V_EVENT(
"EVENT: creating event: [%p, %p, %s, %s, %d]", func, args, name, s_name, s_line);
235 g_async_queue_lock(event_loop->
queue);
238 g_async_queue_unlock(event_loop->
queue);
243 g_async_queue_unlock(event_loop->
queue);
254 signal_call(scheduler);
258 if(TVERB_EVENT && strcmp(e->
name,
"log_event") != 0)
262 if(TVERB_EVENT && strcmp(e->
name,
"log_event") != 0)
268 update_call(scheduler);
287 event_signal(NULL, NULL);
int event_loop_put(event_loop_t *event_loop, event_t *e)
void event_destroy(event_t *e)
Free any memory associated with an event.
char * name
Name of the event, used for debugging.
int occupied
Does this loop already have a worker thread.
event_t * event_init(void(*func)(scheduler_t *, void *), void *arg, char *name, char *source_name, uint16_t source_line)
void event_loop_terminate()
Stops the event loop from executing.
void event_signal_ext(void *func, void *args, char *name, char *s_name, uint16_t s_line)
uint16_t s_line
Sample source line number.
event_t * event_loop_take(event_loop_t *event_loop)
void * argument
The arguments for the function.
void(* func)(scheduler_t *, void *)
The function that will be executed for this event.
uint16_t source_line
Line in the source file creating the event.
Event handling operations.
event_loop_t vl_singleton
GAsyncQueue * queue
The queue that is the core of the event loop.
GThread * main_thread
Pointer to the main thread.
void event_loop_destroy()
Frees any memory associated with the event queue.
Header file for the scheduler.
char * source_name
Name of the source file creating the event.
char * s_name
Sample source file name.
event_loop_t * event_loop_get()
int terminated
Flag that signals the end of the event loop.
int event_loop_enter(scheduler_t *scheduler, void(*update_call)(scheduler_t *), void(*signal_call)(scheduler_t *))
Enters the event loop.