Purpose |
Specify that a procedure be made ThreadSafe accessing global data. |
Syntax |
SUB name() THREADSAFE FASTPROC name() THREADSAFE AS Long FUNCTION name() THREADSAFE AS Single METHOD name() THREADSAFE CLASS METHOD name() THREADSAFE PROPERTY SET name(value) THREADSAFE |
Remarks |
When you create a program with multiple
When a procedure is declared THREADSAFE, PowerBASIC automatically establishes a semaphore which allows only one thread to execute it at a time. Others must wait until the first thread exits the THREADSAFE procedure before they are allowed to begin. Obviously, THREADSAFE procedures should be made as small as possible. By limiting them to just the essential data access, you will minimize the possibility of unwanted delays of execution. |
See also |