MessagePumpCFRunLoopBase::Run() quits on idle |
||||
Issue descriptionDisclaimer: I'm unsure whether this is an actual bug or WAI, but it seems fishy. Assigning to latest contributor, please reroute as appropriate. It seems like MessagePumpCFRunLoopBase::Run() returns as soon as there's nothing to do (idle). Other message pumps seem to do something like WaitForWork() in such cases. I believe functions like RunLoop::Run() rely on this behavior: it documents "Run the current RunLoop::Delegate. This blocks until Quit is called". Am I missing something? I'm currently trying to verify this on trybots, perhaps I'm reading the code wrong.
,
Nov 15 2017
I own too many bugs right now, so I'm Wontfixing - feel free to reopen.
,
Nov 15 2017
Thanks! Reopening for a follow-up question. I only see the call to CFRunLoopRunInMode(), not sure which second branch you're referring to. You're right that the documentation specifies that the distant future should be reached if returnAfterSourceHandled==false, which is the case. But then, why does the function have a loop? Why is kCFRunLoopRunFinished handled in https://cs.chromium.org/chromium/src/base/message_loop/message_pump_mac.mm?l=673&rcl=918863bc4660aa0cc992b6cb7d4611bb4809e6a6?
,
Nov 15 2017
DoRun is a virtual method. The UI thread uses NSRunLoop. MessagePumpNSRunLoop::DoRun has a loop too - maybe that's a clue. The loops are probably there for a good reason. Do you think it's a bug? Sounds like you could do some research if you're interested - Apple's documentation probably has the answer. Perhaps start at https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/RunLoopManagement.html |
||||
►
Sign in to add a comment |
||||
Comment 1 by tapted@chromium.org
, Nov 15 2017Seems it calls DoRun, which invokes either CFRunLoopRunInMode with kCFTimeIntervalMax, or [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; i.e. both say "block until there is work available or until the "distant future" has been reached (i.e. forever).