http://www.perlmonks.org?node_id=445794


in reply to Re^2: Splitting one large timeout into few smaller ones..
in thread Splitting one large timeout into few smaller ones..

One thing you should know about POE is that it uses cooperative multitasking. Your example with "sleep" would not work as you wanted under POE without some changes. As it says here:

As noted above, a POE application is a single-threaded process that pretends to perform asynchronous actions through a technique called cooperative multitasking. At any given time, only one subroutine inside a POE application is executing. If that one subroutine has a sleep 60; inside of it, the entire application will sleep for 60 seconds. No alarms will be triggered; no actions will occur. Smaller blocks of code mean that POE gets a chance to do other actions like cleaning up sessions that are shutting down or executing another event.

That's why I suggested POE could manage your tasks if each was in a child process. It may be more trouble to adapt to POE than it's worth to you in this particular case, but if you were going to adopt Roy Johnson's forking idea, it would simplify the process management and communication.

  • Comment on Re^3: Splitting one large timeout into few smaller ones..