X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fio%2Fasync%2FAsyncSignalHandler.h;h=056655337cb7accbc3dd7adf0e34f9fc188ee5e6;hp=f4b6bdf6b606b511adfc0920c4ccaca131369b9d;hb=dc1c3dcc04baa70029d16351d4424af4a7ef4385;hpb=46c5dbce6c04234ae0185d3fadb62556c7e7625b diff --git a/folly/io/async/AsyncSignalHandler.h b/folly/io/async/AsyncSignalHandler.h index f4b6bdf6..05665533 100644 --- a/folly/io/async/AsyncSignalHandler.h +++ b/folly/io/async/AsyncSignalHandler.h @@ -48,6 +48,30 @@ class AsyncSignalHandler { explicit AsyncSignalHandler(EventBase* eventBase); virtual ~AsyncSignalHandler(); + /** + * Attach this AsyncSignalHandler to an EventBase. + * + * This should only be called if the AsyncSignalHandler is not currently + * registered for any signals and is not currently attached to an existing + * EventBase. + */ + void attachEventBase(EventBase* eventBase); + + /** + * Detach this AsyncSignalHandler from its EventBase. + * + * This should only be called if the AsyncSignalHandler is not currently + * registered for any signals. + */ + void detachEventBase(); + + /** + * Get the EventBase used by this AsyncSignalHandler. + */ + EventBase* getEventBase() const { + return eventBase_; + } + /** * Register to receive callbacks about the specified signal. * @@ -86,7 +110,7 @@ class AsyncSignalHandler { static void libeventCallback(libevent_fd_t signum, short events, void* arg); - EventBase* eventBase_; + EventBase* eventBase_{nullptr}; SignalEventMap signalEvents_; };