Skip to content

[SR-3300] RunLoop.run() blocks with small time intervals on Linux #4435

@swift-ci

Description

@swift-ci
Previous ID SR-3300
Radar None
Original Reporter zmeyc (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Swift version 3.0.2 (swift-3.0.2-PREVIEW-1)

Additional Detail from JIRA
Votes 2
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: bafa9468ae3286e6034cfc307205daa4

Issue Description:

Linux / OS X implementation inconsistency:
If RunLoop.run() is given a very small time interval (such as 0.000001) or zero or negative time interval, it blocks on Linux. On OS X it returns immediately.

import Foundation
import Dispatch

while true {
    print("Loop")
    RunLoop.current.run(mode: RunLoopMode.defaultRunLoopMode, before: Date(timeIntervalSinceNow: 0.000001))
}

"Loop" is printed once, then the app blocks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions