in reply to Detect a hung process
Otherwise, if you want to interrupt the calls, look at timing them out with alarm(). This doesn't always work (esp for IO blocked calls).
One low tech solution might be to have your program touch a file just before it begins a blockable call. Another process could watch for this file and complain loudly if it existed and its timestamp was old. Once your first process finished the call, it could just remove the touched file. You can use lockfiles, logfiles, semaphores, shared memory, signals, parent/child pipes, etc in the same kind of way if you are creative, but of course you have to implement this every place in your code where you make this kind of call.
|
|---|