Tech Tip: Compiler directives still require thread-safe commands during execution
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: November 8, 2021
When using the compiler directives //%T- and //%T+, any code within the directive still must be considered thread-safe in order to execute properly without any errors. The compiler directives are only to be used to disable the compiler's thread-safety checking for any code within the directives.
For example, the code below will allow 4D to compile without errors, but executing the code will still throw out an error during the DIALOG command.
PROCESS PROPERTIES(Current process;$name;$state;$time;$flags) $isPreemptive:=($flags ?? 1) If ($isPreemptive) // Your thread-safe code here Else //%T- DIALOG("errDialog") //%T+ End if |
In practice, compiler directives should scarcely be used as we highly recommend having thread-safe method only call other thread-safe methods and commands.