We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 65dbe53 commit 936c846Copy full SHA for 936c846
ExecutionContext/ExecutionContext.swift
@@ -159,3 +159,11 @@ public let global:ExecutionContextType = ExecutionContext.global
159
public func executionContext(executor:Executor) -> ExecutionContextType {
160
return CustomExecutionContext(executor: executor)
161
}
162
+
163
+public func sleep(timeout:Double) {
164
+ let sec = time_t(timeout)
165
+ let nsec = Int((timeout - Double(sec)) * 1000 * 1000 * 1000)//nano seconds
166
+ var time = timespec(tv_sec:sec, tv_nsec: nsec)
167
168
+ nanosleep(&time, nil)
169
+}
0 commit comments