Ct_user_exit ct_install_pre_function( Ct_user_exit func );
Immediately before invoking each thread's own callback function, the scheduler invokes the pre-thread user exit, if one is installed, passing it the same void pointer that it will pass to the thread's own callback function.
A pre-thread user exit executes fully in the context of the thread following it. For example, if the user exit calls ct_self(), it receives the same return value that the following thread would receive. It can terminate that thread by calling ct_exit() -- the thread will still run, but for only one last time. Because it receives the same void pointer as the thread's own callback function, it can access the same data.
If the application saves the return value of ct_install_pre_function(), it can restore the previous user exit.
The application can disable whatever pre-thread user exit is in effect by passing a null pointer to ct_install_pre_function().
See also: ct_install_post_function()