Unit 'exec' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#morphunits]

Forbid

Forbid task scheduling.

Declaration

Source position: exec.pas line 1805

procedure Forbid;

Description

Prevents other tasks from being scheduled to run by the dispatcher, until a matching Permit() is executed, or this task is scheduled to Wait(). Interrupts are not disabled.

The current task will not be rescheduled as long as it is ready to run. In the event that the current task enters a wait state, other tasks may be scheduled. Upon return from the wait state, the original task will continue to run without disturbing the Forbid().

Calls to Forbid() nest. In order to restore normal task rescheduling, the programmer must execute exactly one call to Permit() for every call to Forbid().

Warning:

In the event of a task entering a Wait() after a Forbid(), the system "breaks" the forbidden state and runs normally until the task which called Forbid() is rescheduled. If caution is not taken, this can cause subtile bugs, since any device or DOS call will (in effect) cause your task to wait.

See also

Permit

  

Permit task rescheduling.

Disable

  

Disable interrupt processing

Enable

  

Enable interrupt processing


Documentation generated on: 2021-07-30