Offers some wrappers for the usage of fork to call expensive blocking
functions without interrupting the main process and without the need to
synchronize.
Usage Example:
importocean.sys.SafeFork;
voidmain ( )
{
autodont_block = newSafeFork(&blocking_function);
dont_block.call(); // call blocking_functionif ( !dont_block.call() )
{
Stdout("blocking function is currently running and not done yet!");
}
while ( dont_block.isRunning() )
{
Stdout("blocking function is still running!");
}
if ( !dont_block.call() )
{
Stdout("blocking function is currently running and not done yet!");
}
dont_block.call(true); // wait for a unfinished fork and then call// blocking_function without forking
}
Call the delegate, possibly within a fork.
Ensures that the delegate will only be called when there is not already
a fork running. The fork exits after the delegate returned.
SafeFork
Offers some wrappers for the usage of fork to call expensive blocking functions without interrupting the main process and without the need to synchronize.
Usage Example: