I have a multithreded application in perl for which I have to rely on several non-thread safe modules, so I have been using fork()ed processes with kill() signals as a message passing interface.
The problem is that the signal handlers are a bit erratic (to say the least) and often end up with processes that get killed in inapropriate states.
Is there a better way to do this?
Have a look at forks.pm, a ‘drop-in replacement for Perl threads using fork()’ which makes for much more sensible memory usage (but don’t use it on Win32). It will allow you to declare ‘shared’ variables and then it automatically passes changes made to such variables between the processes (similar to how threads.pm does things).