watching worker time processes

rahed raherh at gmail.com
Fri Mar 13 14:10:49 CET 2015


Marc Lehmann <schmorp at schmorp.de> writes:

> So you want to enforce a limit on cpu time.

Actually it's a calling of external systems over a network, so there
should be some time limit to the job in time.
>
> I don't think there is a good way to to this for perl, as perl doesn't
> interrupt opcodes because of a signal, so in general, you might never
> catch the signal.
>
> What would work reliably is to let the OS kill your process afteer a while.
> SIGALRM without a signal handler will achieve that, but AnyEvent::Fork::RPC
> will consider this an error.

In the meantime I tried to use die when SIGALARM fires and it worked (in
a particular scenario), eval block with alarm was interrupted and worker
code continued.

>
> If all you want is some subprocess and time-limit it, without passing data
> (as in your example), you should be able to do this with AnyEvent::Fork
> alone, i.e. something like this (your code kept the >).

I do want to pass data to a parent. Wasn't it a line $done->($data); in
the worker?

Thank you for your time.

-- 
Radek



More information about the anyevent mailing list