File Gate.lua

Functions

Gate:block (revokeExistingEntries) Block the gate.
Gate:enter () Enter immediately, if possible, else wait for those ahead, if not too many.
Gate:exit () Release hold for next in line to enter.
Gate:getEntryCount () Get number of tasks that've entered or are trying to enter the gate.
Gate:isIdle () Determine if any body is in, or trying to get in the gate or not.
Gate:new (t) Constructor for new instance objects.
Gate:newClass (t) Constructor for class extension.
Gate:unblock (revokeExistingEntries) Unblock the gate.


Functions

Gate:block (revokeExistingEntries)
Block the gate.

Parameters:

  • revokeExistingEntries: (boolean, default=false) i.e. default is to send existing waiters packing.

Usage:

  • useful for denying changes best ignored whilst things are done that would otherwise result in unwanted change processing.
  • make sure unblocking happens despite errors. 
Gate:enter ()
Enter immediately, if possible, else wait for those ahead, if not too many.
Gate:exit ()
Release hold for next in line to enter.
Gate:getEntryCount ()
Get number of tasks that've entered or are trying to enter the gate.
Gate:isIdle ()
Determine if any body is in, or trying to get in the gate or not.
Gate:new (t)
Constructor for new instance objects.

Parameters:

  • t:
Gate:newClass (t)
Constructor for class extension.

Parameters:

  • t:
Gate:unblock (revokeExistingEntries)
Unblock the gate.

Parameters:

  • revokeExistingEntries: (boolean, default=false) i.e. default is to send accrued waiters packing before clearage.

Usage:

  • to resume normal passage.
  • make sure unblocking happens despite errors.
  • since Lua is non-preemptive, and gating/blocking applies to other running tasks, the blocking task must yield between blocking and unblocking or it won't do any good - consider passing true, to assure such is the case. 

Valid XHTML 1.0!