Skip to content

Commit 823fa0f

Browse files
committed
Code review fixes
1 parent cefb963 commit 823fa0f

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

CoreFoundation/RunLoop.subproj/CFRunLoop.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2406,8 +2406,9 @@ static Boolean __CFRunLoopServiceFileDescriptors(__CFPortSet portSet, __CFPort o
24062406
} while (result == -1 && errno == EINTR);
24072407
CFAssert2(result >= 0, __kCFLogAssertion, "%s(): error %d from epoll_wait", __PRETTY_FUNCTION__, errno);
24082408

2409-
if (result == 0)
2409+
if (result == 0) {
24102410
return false;
2411+
}
24112412

24122413
awokenFd = event.data.fd;
24132414
}

Foundation/NSRunLoop.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ public let NSDefaultRunLoopMode: String = kCFRunLoopDefaultMode._swiftObject
1313
public let NSRunLoopCommonModes: String = kCFRunLoopCommonModes._swiftObject
1414

1515
public class NSRunLoop : NSObject {
16-
typealias CFType = CFRunLoopRef
17-
internal var _cfObject : CFType!
16+
internal var _cfRunLoop : CFRunLoopRef!
1817
internal static var _mainRunLoop : NSRunLoop = {
1918
return NSRunLoop(cfObject: CFRunLoopGetMain())
2019
}()
2120

2221
internal init(cfObject : CFRunLoopRef) {
23-
_cfObject = cfObject
22+
_cfRunLoop = cfObject
2423
}
2524

2625
public class func currentRunLoop() -> NSRunLoop {
@@ -32,25 +31,28 @@ public class NSRunLoop : NSObject {
3231
}
3332

3433
public var currentMode: String? {
35-
return CFRunLoopCopyCurrentMode(_cfObject)?._swiftObject
34+
return CFRunLoopCopyCurrentMode(_cfRunLoop)?._swiftObject
3635
}
3736

3837
public func addTimer(timer: NSTimer, forMode mode: String) {
3938
CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer._cfObject, mode._cfObject)
4039
}
4140

4241
public func addPort(aPort: NSPort, forMode mode: String) {
43-
// CFRunLoopAddSource(CFRunLoopGetCurrent(), aPort._cfObject, mode._cfObject)
4442
NSUnimplemented()
4543
}
4644

4745
public func removePort(aPort: NSPort, forMode mode: String) {
48-
// CFRunLoopRemoveSource(CFRunLoopGetCurrent(), aPort._cfObject, mode._cfObject)
4946
NSUnimplemented()
5047
}
5148

5249
public func limitDateForMode(mode: String) -> NSDate? {
5350
let nextTimerFireAbsoluteTime = CFRunLoopGetNextTimerFireDate(CFRunLoopGetCurrent(), mode._cfObject)
51+
52+
if (nextTimerFireAbsoluteTime == 0) {
53+
return NSDate.distantFuture()
54+
}
55+
5456
return NSDate(timeIntervalSinceReferenceDate: nextTimerFireAbsoluteTime)
5557
}
5658

closure/runtime.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@
1212
#include <stdlib.h>
1313
#include <string.h>
1414
#include <stdint.h>
15-
#if TARGET_OS_LINUX
16-
#define __USE_GNU
1715
#include <dlfcn.h>
18-
#else
19-
#include <dlfcn.h>
20-
#endif
2116
#if __has_include(<os/assumes.h>)
2217
#include <os/assumes.h>
2318
#else

0 commit comments

Comments
 (0)