{{htmlmetatags>metatag-robots=() metatag-title=(ALLOW | ugBASIC User Manual) metatag-keywords=(ugBASIC,Commodore 64,Commodore PLUS/4,ZX Spectrum) metatag-description=(Manual page for ALLOW) metatag-media-og:image=(:ugbasic:logo-ugbasic-fb.png) metatag-og:title=(ALLOW | ugBASIC User Manual) metatag-og:description=(Manual page for ALLOW) }} ====== ugBASIC User Manual ====== ===== ALLOW ===== ===== SYNTAX ===== ALLOW ==== PURPOSE ==== The ''ALLOW'' instruction is the opposite of the ''FORBID'' function. While ''FORBID'' completely blocks multitasking, ''ALLOW'' re-enables it, allowing ugBASIC to schedule again the execution of other tasks, passing the execution from one task to another according to its scheduling policy. If a ''PROCEDURE'' has previously called ''FORBID'' to assure exclusive access to the CPU, ''ALLOW'' returns control to the other procedures, allowing other procedures to continue execution. Note that this type of control is "static": in other words, compilation will stop if the procedure that called ''FORBID'' subsequently wants to call a function that would require multitasking to be active. The call to ''ALLOW'' will restore multitasking, and allow routines of this type to be called. Once a procedure has finished executing a section of code that required exclusive access to the processor, it should call ''ALLOW'' to allow other tasks to be executed. If a task needs to wait for an event (for example, a signal), it can call ''ALLOW'' before entering a waiting state, allowing other tasks to execute their code while the waiting task is suspended. Using ''FORBID'' and ''ALLOW'' in a balanced way is essential to achieve both good performance and correct synchronization between parallel procedures. In many cases, more sophisticated synchronization mechanisms, such as shared variables, could be used without completely disabling multitasking. ==== EXAMPLE ==== PARALLEL PROCEDURE test FORBID ' busy waiting, multitasking is suspended! FOR i=0 TO 1000: WAIT 1 MS : NEXT i ALLOW END PROC ==== ABBREVIATION ==== Alw ==== AVAILABLE ON ==== * * Atari (400/800) * Atari XL/XE * Commodore 128 (MOS 8502) * Commodore 128 (Zilog Z80) * Commodore 64 * Commodore 64+REU * TRS-80 Color Computer * TRS-80 Color Computer 3 * ColecoVision * Amstrad CPC 664 * Dragon 32 * Dragon 64 * Thomson MO5 * Thomson MO5 * Olivetti Prodest PC128 * Commodore PLUS/4 * SEGA SC-3000 * SEGA SG-1000 * * VG-5000 * Commodore VIC-20 * ZX Spectrum 48 ==== SEE ALSO ==== [[FORBID]] ==== ANY PROBLEM? ==== If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please [[https://github.com/spotlessmind1975/ugbasic/issues/new?title=ISSUE ON ALLOW|open an issue]] for this keyword on GitHub. Thank you!===== POWERED BY ===== [[:ugbasic:user:index|{{ :ugbasic:user:logo-ugbasic.png?nolink&600 |}}]]