in reply to Re^2: multiple infinitive loops
in thread multiple infinitive loops

I was working on a perl script under windows recently and found that it blocked (wouldn't even time out) while attempting to connect to a network socket (This wasn't a problem on other platforms.). I ended up forking a child process to attempt the connection, and having the parent kill it if it went too long. From what you've shown so far, I would suggest trying to fork a child process for each of those event-handling tasks. That would allow both event handlers to be available and avoid blocking everything when one process blocks.