Well, if one defines "hanging" as "using more CPU time than a certain, fixed amount", then one could use wait_all_children in the parent process, and set CPU time limits with BSD::Resource in each child process.
Of course that requires re-organizing the previous task of the parent process into a child process, but as the others have mentioned, that's a pretty good idea anyway.