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, NULLOK(void (*handler)(int)))
static void Parrot_unblock_signal(int sig)
PARROT_API void Parrot_init_signals(void)
static void init_events_first(PARROT_INTERP)
static void init_events_all(PARROT_INTERP)
PARROT_API void Parrot_init_events(PARROT_INTERP)
PARROT_API void Parrot_schedule_event(PARROT_INTERP, NOTNULL(parrot_event *ev))
static void schedule_signal_event(int signum)
PARROT_API void Parrot_new_timer_event(PARROT_INTERP, NULLOK(PMC *timer), FLOATVAL diff, FLOATVAL interval, int repeat, NULLOK(PMC *sub), parrot_event_type_enum typ)
diff
from now,
repeated at interval
and running the passed sub
.PARROT_API void Parrot_new_cb_event(PARROT_INTERP, NOTNULL(PMC *cbi), NOTNULL(char *ext))
PARROT_API void Parrot_del_timer_event(PARROT_INTERP, NOTNULL(PMC *timer))
timer
.PARROT_API void Parrot_new_terminate_event(PARROT_INTERP)
PARROT_API void Parrot_new_suspend_for_gc_event(PARROT_INTERP)
PARROT_API void Parrot_kill_event_loop(void)
PARROT_API void Parrot_schedule_interp_qentry(PARROT_INTERP, NOTNULL(struct QUEUE_ENTRY *entry))
void Parrot_schedule_broadcast_qentry(NOTNULL(struct QUEUE_ENTRY *entry))
static void store_io_event(NOTNULL(pending_io_events *ios), NOTNULL(parrot_event *ev))
static void io_thread_ready_rd(NOTNULL(pending_io_events *ios), int ready_rd)
PARROT_CAN_RETURN_NULL static void *io_thread(SHIM(void *data))
static void stop_io_thread(void)
PARROT_API void Parrot_event_add_io_event(PARROT_INTERP, NULLOK(PMC *pio), NULLOK(PMC *sub), NULLOK(PMC *data), INTVAL which)
PARROT_MALLOC PARROT_CANNOT_RETURN_NULL static QUEUE_ENTRY *dup_entry(NOTNULL(const QUEUE_ENTRY *entry))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static QUEUE_ENTRY *dup_entry_interval(NOTNULL(QUEUE_ENTRY *entry), FLOATVAL now)
abs_time
.static int process_events(NOTNULL(QUEUE *event_q))
PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL static void *event_thread(NOTNULL(void *data))
PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL static opcode_t *wait_for_wakeup(PARROT_INTERP, NULLOK(opcode_t *next))
PARROT_API PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL opcode_t *Parrot_sleep_on_event(PARROT_INTERP, FLOATVAL t, NULLOK(opcode_t *next))
sleep
opcode.PARROT_API PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL opcode_t *Parrot_do_check_events(PARROT_INTERP, NULLOK(opcode_t *next))
sync
called by the check_event opcode from run loops.static void event_to_exception(PARROT_INTERP, NOTNULL(const parrot_event *event))
PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL static opcode_t *do_event(PARROT_INTERP, NOTNULL(parrot_event *event), NULLOK(opcode_t *next))
PARROT_API PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL opcode_t *Parrot_do_handle_events(PARROT_INTERP, int restore, NULLOK(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.
|