diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-04-15 17:31:09 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-04-15 17:31:09 +0000 |
commit | 2ddb245fac99802e63742c21f7da0d499e9cecf6 (patch) | |
tree | 3eebbf1aeed8269c8b14de81e8b680e784b8709b /Foundation/GTMSignalHandler.m | |
parent | 30ac0ff87b594d7bca3a5cc2789ca415840ea0b1 (diff) |
[Author: dmaclach]
refactor GTMUnitTestingUtilities into GTMAppKitUnitTestingUtilties and GTMFoundationUnitTestingUtilities.
convert GTMSignalHandler over to using new runloop routines
fix bug in GTMSignalHandler API with GC where releasing it wasn't sufficient to stop it listening.
R=thomasvl
DELTA=1227 (638 added, 566 deleted, 23 changed)
Diffstat (limited to 'Foundation/GTMSignalHandler.m')
-rw-r--r-- | Foundation/GTMSignalHandler.m | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Foundation/GTMSignalHandler.m b/Foundation/GTMSignalHandler.m index dd67269..677c10a 100644 --- a/Foundation/GTMSignalHandler.m +++ b/Foundation/GTMSignalHandler.m @@ -44,7 +44,6 @@ static CFSocketRef gRunLoopSocket = NULL; - (void)notify; - (void)addFileDescriptorMonitor:(int)fd; - (void)registerWithKQueue; -- (void)unregisterWithKQueue; @end @@ -88,19 +87,17 @@ static CFSocketRef gRunLoopSocket = NULL; } #if GTM_SUPPORT_GC + - (void)finalize { - [self unregisterWithKQueue]; - + [self invalidate]; [super finalize]; - } + #endif - (void)dealloc { - [self unregisterWithKQueue]; - + [self invalidate]; [super dealloc]; - } // Cribbed from Advanced Mac OS X Programming. @@ -181,7 +178,7 @@ static void SocketCallBack(CFSocketRef socketref, CFSocketCallBackType type, } -- (void)unregisterWithKQueue { +- (void)invalidate { // Short-circuit cases where we didn't actually register a kqueue event. if (signo_ == 0) return; if (action_ == nil) return; @@ -193,7 +190,10 @@ static void SocketCallBack(CFSocketRef socketref, CFSocketCallBackType type, if (kevent(gSignalKQueueFileDescriptor, &filter, 1, NULL, 0, &noWait) != 0) { _GTMDevLog(@"could not remove event for signal %d. Errno %d", signo_, errno); // COV_NF_LINE } - + + // Set action_ to nil so that if invalidate is called on us twice, + // nothing happens. + action_ = nil; } - (void)notify { |