in reply to how long does for(1..$n) take?
If your thing cannot be interrupted, then keep track of the Time.
which is still polling (which is generally bad), but at least after you finish that iteration, you'll know whether to quit or not.while($runningtime<$maxtime) { dosomething(); }
Another another option may be to use perlembed to embed an interpreter in a pthread, which is sent an internal signal to finish from another thread after 60 seconds of sleep. The murdered thread can have cleanup handlers installed to ensure that the important stuff got done and now you can finish. I would consider this the most professional way. Good luck!
|
|---|