Expand/Shrink

try_cs

Definition: bool b = try_cs(integer cs)
Description: As enter_cs, but yields false (0) if the lock cannot be obtained instantly.
pwa/p2js: Not supported.
Comments: Unlike enter_cs, a prevously declared (user-defined) critical section must be specified, since the hidden internal stdcs should not be used when expecting even the slightest lock contention.
Example:
while try_cs(mycs)=0 do
    trySomethingElse()
end while
...
leave_cs(mycs)
Implementation: via :%pTryCS in builtins\VM\pHeap.e (an autoinclude).
See Also: init_cs, delete_cs, enter_cs, leave_cs