Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 67400
Status: resolved
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: justin [...] hawkins.id.au
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Non blocking alternative to POE::Kernel->run_one_timeslice ?
Date: Tue, 12 Apr 2011 19:43:52 +0930
To: bug-POE [...] rt.cpan.org
From: Justin Hawkins <justin [...] hawkins.id.au>
Hi, It would be nice to be able to combine Mojolicious (or other systems) with POE. Mojolicious has a trivial interface to keeping an alternative event queue alive, the example is here: https://github.com/kraih/mojo/wiki/Mojolicious-and-POE/b1004e700082e713d41fe46315068581f48651b7 Unfortunately this does not quite work as expected, as run_one_timeslice blocks until the next piece of work on the queue is processed. So if the queue has only one event in 15s from now, the call will block (and the web server will stop) until that piece of work has been done. I have found this blocking behaviour on POE-1.299. Would it be possible to enhance this function to allow for non-blocking behaviour? Or add a new function that returns immediately if no work is due to be done? Alternatively, if there is an easy way to find out before calling run_one_timeslice if there is work due, that would also be useful. Regards, Justin -- Justin Hawkins justin@hawkins.id.au
Hello. In IRC I suggested using a yield() loop in POE so that each call to run_one_timeslice() would immediately have a timeslice to run and would therefore not block. How's that working out for you? If you'd rather it wait up to 1/10 second for activity, you can delay(loop => 0.1) instead. If these are sufficient solutions for your purpose, then I won't need to submit deep logic patches to 16 different POE::Loop event loop adapters. :)
Considering this issue resolved. A workaround was identified on-ticket, and the original requester has no further questions or comments.