As an alternative to what virtualsue has shown, you could also write you code with an "event-loop" system like POE, or any of the GUI's, like Tk,Gtk2, etc. You could then start separate timers to monitor each lwp request. Another advantage of that type of system, is that you could log the times for each lwp request.