[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

16.1 Setting Up Async Event Handlers

Asynchronous event handlers are configured through the ^$JOB structured system variable for job-specific events, and the ^$SYSTEM structured system variable for system-wide events. In order to become proficient in writing asynchronous event handling code, you need to be aware of several important concepts:

Event Classes

Event classes denote particular categories of events. These include COMM, HALT, IPC, INTERRUPT, POWER, TIMER, TRIGGER, and USER event classes. At present, only INTERRUPT and TRIGGER event classes are supported.

Event Identifiers

Event identifiers denote the precise nature of the event that has occurred. For instance, resizing the terminal window in which a FreeM job is running will send an event of class INTERRUPT with an event identifier of SIGWINCH (short for SIGnal WINdow CHange).

Event Handlers

Event handlers are M routines or subroutines that can be registered to run when an event of a certain event class occurs.

Event Registration

Event registration is the process of modifying the ^$JOB or ^$SYSTEM SSVN to associate a particular event class and event identifier with an event handler routine or subroutine.

Event Blocking and Unblocking

Event blocking is the means by which asynchronous event handling can be temporarily suspended. For example, asynchronous events are temporarily and implicitly blocked for the duration of event handler execution, unless explicitly un-blocked within the event handler. Event handling can also be blocked and unblocked programatically from M code using the ABLOCK and AUNBLOCK commands.

The following sections of this chapter will take you step-by-step through setting up an event handler for SIGWINCH signal handling.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on September 20, 2023 using texi2html 5.0.