New issue
Advanced search Search tips

Issue 785165 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Nov 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

MessagePumpCFRunLoopBase::Run() quits on idle

Project Member Reported by mastiz@chromium.org, Nov 15 2017

Issue description

Disclaimer: 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.
 

Comment 1 by tapted@chromium.org, Nov 15 2017

Seems 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).

Comment 2 by tapted@chromium.org, Nov 15 2017

Status: WontFix (was: Untriaged)
I own too many bugs right now, so I'm Wontfixing - feel free to reopen.

Comment 3 by mastiz@chromium.org, Nov 15 2017

Status: Assigned (was: WontFix)
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?

Comment 4 by tapted@chromium.org, Nov 15 2017

Status: WontFix (was: Assigned)
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