From 5023c1cabeecfae4d3124f043b1543ecac7e4d4f Mon Sep 17 00:00:00 2001 From: dmaclach Date: Tue, 13 Nov 2018 11:14:18 -0800 Subject: Fixed up GTMSignalHandler and deprecated it. (#192) This gets GTMSignalHandler working with libdispatch, and also marks it as deprecated because it is probably easier just to write your own version to call a block instead of the method invocation here. This also makes the tests run again which hasn't been happening for a long time AFAICT. --- Foundation/GTMSignalHandler.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Foundation/GTMSignalHandler.h') diff --git a/Foundation/GTMSignalHandler.h b/Foundation/GTMSignalHandler.h index 5f4b028..eec0e24 100644 --- a/Foundation/GTMSignalHandler.h +++ b/Foundation/GTMSignalHandler.h @@ -23,7 +23,7 @@ // // This is a very simple, easy-to-use class for registering handlers that get // called when a specific signal is delivered. Also handy for ignoring -// inconvenient signals. Ignoring SIGKILL is not support for what should be +// inconvenient signals. Ignoring SIGKILL is not supported for what should be // obvious reasons. You can pass nil for target & action to ignore the signal. // // Example of how to catch SIGABRT and SIGTERM while ignring SIGWINCH: @@ -53,16 +53,15 @@ // // Multiple handlers for the same signal is NOT supported. // -// kqueue() is used to handle the signals, and the default runloop for the first -// signal handler is used for signal delivery, so keep that in mind when you're -// using this class. This class explicitly does not handle arbitrary runloops -// and threading. -// +// libdispatch is used to handle the signals. NB that sending a signal +// from dispatch_get_main_queue will not get caught in a CFRunLoop based run +// loop. +// https://openradar.appspot.com/radar?id=5030997057863680 + +NS_DEPRECATED(10_0, 10_6, 1_0, 4_0, "Use a DISPATCH_SOURCE_TYPE_SIGNAL dispatch source.") @interface GTMSignalHandler : NSObject { @private - int signo_; - GTM_WEAK id target_; - SEL action_; + dispatch_source_t signalSource_; } // Returns a retained signal handler object that will invoke |handler| on the -- cgit v1.2.3