in reply to Proposal how to make modules using fork more portable
Personally, I would translate any normally fatal signal into a direct call to TerminateThread() if the process ID that is the subject of the signal is a pseudo-process ID.
Whilst TerminateThread() is usually a bad thing, given the aim here is to allow the main thread to get past a wait or waitpid and exit the process, when the thread will be summarily abandoned anyway, it amounts to the same thing.
The advantage is that you supply TerminateThread() with an exit code, which will then be reported back (via GetExitCodeThread()) as if it were the return value from the thread proc in the normal way, hence to the the rest of perl, and the program, it will seems as if the thread just ended.
Of course, clean-up will not have been done, so it will likely leak like a bitch and possibly cause deadlocks through unreleased semaphores, mutexes and critsecs. But if the goal is just to allow the main process to terminate, that doesn't matter.
|
|---|