in reply to Database queueing and signals

I don't see any problems with this design. You have to be a little careful what you do in a signal handler, but setting a flag variable should be safe on all systems.

The question is, what do the child processes do while they're waiting to receive the signal? You don't want them busy-waiting, or they'll tie up the CPU. You can probably make something work with sleep, or select. The pause system call is what you really want, but native Perl doesn't provide an interface to it. You may be able to code one up in XS, or just make do with other functions.

Replies are listed 'Best First'.
Re: Re: Database queueing and signals
by Marcello (Hermit) on Apr 07, 2004 at 19:48 UTC
    Thanks for your input.

    Child processes indeed sleep for 200 milliseconds after querying the database, to prevent a high CPU/database load:
    select(undef, undef, undef, 0.2);