CFRunLoop compares run loop mode name using ==?

On Linux, a Timer scheduled to run in commonModes does not fire.

I doubt if this is due to the implementation of CFRunLoop in which the comparisons of mode name against kCFRunLoopCommonModes used pointer comparison ==, rather than a more conservative CFEqual call. The Swift part of RunLoopMode enum does not seem to refer to the exact CFString constant defined in CFRunLoop, so the comparison would always fail. If this is what happens, then CFRunLoopAddTimer(), CFRunLoopAddObserver(), CFRunLoopAddSource() and other APIs would fail.

I've filed bug report SR-6810.

Yah, this is an optimization we can use easily on Darwin because the exported string constant is going to be the same pointer value as the one passed in. Usually we fall back to CFEqual, but in cases like this that could be a pretty significant performance impact. The bug report is a good start -- we'll have to figure out what to do next from there.