-
Notifications
You must be signed in to change notification settings - Fork 10
Description
This is addressed in RT issue [https://rt.cpan.org/Public/Bug/Display.html?id=15538] - essentially, there are times when the automation object can't be trusted to send any more events, and that leaves us stranded in MessageLoop with no way to time out.
A cheap and easy way to implement an optional break-out would simply be to pass a closure in, and call it with call_sv on every trip through the loop. I feel like that would maybe call the closure too often, but I have no feel for how that would be decided or measured. It would, however, be easy. You wouldn't even have to monitor any return - the callback could simply QuitMessageLoop if that's what was appropriate.
I'm going to code this in the next day or two unless somebody tells me it's stupid. I'm pretty sure Windows will regulate how often the message loop gets called, in other words, that tight loop isn't actually using any meaningful system resources except what it costs to run a Perl function in the first place.
The alternative would be to do a SetTimer and trap the WM_TIMER; then, however, QuitMessageLoop would probably need to kill the timer. That feels as though it would be a leak risk.