[saga-rg] wait on tasks...
Tom Goodale
goodale at cct.lsu.edu
Thu Aug 25 09:50:25 CDT 2005
On Thu, 25 Aug 2005, Andre Merzky wrote:
> Quoting [Tom Goodale] (Aug 25 2005):
>>
>> On Wed, 17 Aug 2005, Andre Merzky wrote:
>>
>>> Hi all,
>>>
>>> the wait currently throws a NotRunning exception if the tast
>>> is not running anymore. That basically mean that _every_
>>> wait has to be put into a try/catch, since the programmer
>>> does not know in advance if the task is still active.
>>
>> The can do a getState on the task.
>
> You have a race condition then:
>
> state = task.getState ();
>
> # task finishes now
>
> if ( state == Running )
> {
> task.wait (-1.0); # throws an NotRunning exception
> }
>
> So that does not help.
Good point, but it does if we also change the exception, although they
still might want to put a try around it to catch someone cancelling the
task in the meantime; on the other hand since that could only happen from
within the same program, it's probably something the programmer can decide
if they need to do.
Tom
More information about the saga-rg
mailing list