parrotcode: Event handling stuff | |
Contents | C |
src/events.c - Event handling stuff
An event_thread handles async events for all interpreters.
When events are due,
they are placed in per interpreter task_queues,
where they are handled then by the check_event*
opcodes.
IO events and signals are catched in the io_thread, which again dispatches these to one or all interpreters.
static void sig_handler(int signum)
signum
.SIGHUP
is handled at the moment for testingstatic void Parrot_sigaction(int sig, void (*handler)(int))
static void init_events_first(Parrot_Interp interpreter)
static void init_events_all(Parrot_Interp interpreter)
void Parrot_init_events(Parrot_Interp interpreter)
code
void Parrot_new_timer_event(Parrot_Interp interpreter, PMC *timer, FLOATVAL diff, FLOATVAL interval, int repeat, PMC *sub, parrot_event_type_enum typ)
diff
from now,
repeated at interval
and running the passed sub
.void Parrot_new_cb_event(Parrot_Interp, PMC*cbi, void*ext)
void Parrot_del_timer_event(Parrot_Interp interpreter, PMC *timer)
timer
.void Parrot_new_terminate_event(Parrot_Interp interpreter)
void Parrot_kill_event_loop(void)
void Parrot_schedule_interp_qentry(Parrot_Interp interpreter, QUEUE_ENTRY *entry)
void Parrot_schedule_broadcast_qentry(QUEUE_ENTRY *entry)
static void *io_thread(void *data)
static void stop_io_thread(void)
static QUEUE_ENTRY *dup_entry(QUEUE_ENTRY *entry)
static QUEUE_ENTRY *dup_entry_interval(QUEUE_ENTRY *entry, FLOATVAL now)
abs_time
.static int process_events(QUEUE *event_q)
static void *event_thread(void *data)
static void *wait_for_wakeup(Parrot_Interp interpreter, void *next)
void *Parrot_sleep_on_event(Parrot_Interp interpreter, FLOATVAL t, void *next)
sleep
opcode.void *Parrot_do_check_events(Parrot_Interp interpreter, void *next)
sync
called by the check_event opcode from run loops.static void event_to_exception(Parrot_Interp interpreter, parrot_event *event)
static void *do_event(Parrot_Interp interpreter, parrot_event *event, void *next)
void *Parrot_do_handle_events(Parrot_Interp interpreter, int restore, void *next)
check_event__
opcode from run loops or from above.
When called from the check_events__
opcode,
we have to restore the op_func_table
.include/parrot/events.h and docs/dev/events.pod.
|