Jason Tackaberry wrote:
> On Thu, 2005-08-11 at 16:02 +0000, Dirk Meyer wrote:
>>           # If Notifier callbacks return False, they get unregistered.
>>           if ret == False:
>> !             if id == self._id:
>> !                 # id not changed. This means the callback wasn't restarted
>> !                 # some how and doesn't want to be called again.
>> !                 # This check is needed when restarting a timer in it's own
>> !                 # callback function.
>> !                 self.unregister()
>>               return False
>>           return True
>
> But if a notifier callback restarts a timer, shouldn't it return True?

Yes and no. I have a OneShotTimer. Whatever I return in the callback
function, __call__ for a OneShotTimer return False. So now I'm in the
callback, the timer is already unregistered (because it is a
OneShotTimer). A see 'I need to start the timer again right now' and
do a TheSameOneShotTimer.start(). This should work, but it doesn't
because a OneShotTimer always returns False and it is unregistered by
NotifierCallback. 

> I'm not totally opposed to this change, but when you add complexity to
> how things behave in order to try to make the program "do what I'm
> thinking," that has a way of coming back later to bite you in the ass.

But isn't the stuff I wrote above is what it should do?

> The mechanism was simple: return False, notifier gets unregistered;
> return True, it stays registered.   Is there a scenario where, in
> practice, the notifier callback isn't smart enough to return True when
> it's reregistered itself?

So how to fix it for OneShotTimer? 



Dischi

-- 
Fast, cheap, good: pick two.

Attachment: pgpH8WSMyfnre.pgp
Description: PGP signature

Reply via email to