On 22-5-2010 9:51, Charles wrote:
> Thinking about it further, the downside of this approach is that the
> interval between 'ticks' is not 10 seconds anymore. It is 10 seconds +
> length of time task takes. Perhaps that's not the end of the world, but
> I might have to factor that in somehow.
But this will always be a factor to consider, whatever scenario you
choose. You should ask yourself whether you want the signalling system
to have some form of reentrancy. In other words: Is it allowed to be
signalled while a previous signal is still being processed?
If yes, then the question should be: Is the order of processing the
signals relevant or not? If it's not, you can just start the task on a
separate thread, or queue it on the threadpool. If it is, you'll have to
setup some sort of queue, that processes the signals asynchroniously,
but in queued order.
If no, then there's little you can do about it. Either you make sure the
tasks finishes within the signalling time window (which may or may not
be possible, but will always be very tough to guarantee), or you give up
on reentrancy of the signal.
Willem van Rumpt