AnyEvent driver for Prima

ambrus ambrus at math.bme.hu
Wed Dec 14 13:33:30 CET 2016


>> is there a way to run the event loop blockingly for just one round?
> 
> I think I managed to implement exactly that just now: 
> $::application->yield(1)
> should do it. The code is only on github though.

Great, thank you.

Corion: please modify your draft to use the new yield(1) method in the 
AnyEvent::Impl::Prima::_poll function (and require Prima 1.50 for that).

>> The Prima::Timer watcher is always in periodic repeating mode.  If the
>> timeout is small, is it possible that the timeout fires twice before 
>> the
>> event loop gets a chance to execute the callback the first time?
> 
> This for sure won't happen for x11 backend, but for win32 backend I 
> cannot
> answer that. The timer is implemented using standard SetTimer() 
> function, which
> might or might not send more events in the system message queue. I just 
> wrote a
> script to test this on my Windows 7, all seems ok, but I cannot give 
> you a
> guarantee.

In that case, the driver will have to make sure not to call the timer 
callback twice even if win32 happens to do that.  Corion: can you fix 
that somehow in the code?  It's not completely trivial to do that when 
the AnyEvent timer is periodic.  Also, remove the my declaration of the 
$g variable if you no longer use that.

By the way, why do you try to override AnyEvent::CondVar::Base::_wait?  
The default implementation should call _poll and just work.

-- Ambrus




More information about the anyevent mailing list