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

10.5 Temporarily Blocking Asynchronous Event Handling

To temporarily block processing of specific event classes, you will use the ABLOCK command. ABLOCK functions incrementally, that is, each successive call to ABLOCK will increment a counter of blocks held for the specified event class or classes, and each successive call to AUNBLOCK will decrement that counter. Event handling for the specified event classes will be blocked as long as the ABLOCK counter for those classes is greater than zero. Thus, event blocking is cumulative, in a manner similar to M incremental locks.

The following example blocks asynchronous event handling for the INTERRUPT event class:

 
  ABLOCK "INTERRUPT"

Note that entering an event handler causes an implicit ABLOCK of all event classes, to prevent event handlers from interrupting other event handlers during their execution. This may be overridden by calling AUNBLOCK for one or more event classes within an event handler. However, unblocking event handling during an event handler should be done with great caution, as this can make the flow of code execution somewhat unpredictable, especially if M globals are modified inside of an event handler routine or subroutine.

Modifying M globals within event handlers is allowed but strongly discouraged, as doing so can lead to logical corruption of the database. If you must modify an M global within an event handler, guard all such operations with prodigious and careful use of LOCKs, ensuring that such modifications occur in the desired logical order.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by root on October 14, 2020 using texi2html 1.82.