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 caught 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 interp)
static void init_events_all(Parrot_Interp interp)
void Parrot_init_events(Parrot_Interp interp)
code
void Parrot_new_timer_event(Parrot_Interp interp, 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, char *ext)
void Parrot_del_timer_event(Parrot_Interp interp, PMC *timer)
timer
.void Parrot_new_terminate_event(Parrot_Interp interp)
void Parrot_new_suspend_for_gc_event(Parrot_Interp interp)
void Parrot_kill_event_loop(void)
void Parrot_schedule_interp_qentry(Parrot_Interp interp, 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 opcode_t *wait_for_wakeup(Parrot_Interp interp, opcode_t *next)
opcode_t *Parrot_sleep_on_event(Parrot_Interp interp, FLOATVAL t, opcode_t *next)
sleep
opcode.void *Parrot_do_check_events(Parrot_Interp interp, opcode_t *next)
sync
called by the check_event opcode from run loops.static void event_to_exception(Parrot_Interp interp, parrot_event *event)
static opcode_t *do_event(Parrot_Interp interp, parrot_event *event, opcode_t *next)
opcode_t *Parrot_do_handle_events(Parrot_Interp interp, int restore, opcode_t *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.
|