1 #ifndef __DALI_INTERNAL_ADAPTOR_ABORT_HANDLER_H__
2 #define __DALI_INTERNAL_ADAPTOR_ABORT_HANDLER_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <dali/public-api/signals/callback.h>
26 #include "application.h"
36 * Class to listen to system signals and trigger an abort callback
39 * This class maintains a process wide singleton, as the signal(2) system
40 * call is process specific, not thread specific.
42 * Currently, this precludes having multiple DALi instances in the same process.
49 * @param[in] callback The function to call when abort signals occur
50 * @note The ownership of callback is passed onto this class.
52 AbortHandler( CallbackBase* callback );
60 * Add a signal you want to be handled by this abort handler.
61 * @param[in] signum The signal number (from signum.h)
62 * @return true if the signal handler was installed ok
64 bool AbortOnSignal( int signum );
68 * Signal handler - Called when signal is received.
69 * Stops the application.
71 static void SignalHandler( int signum );
74 * Default constructor - undefined
79 * Copy constructor - undefined
81 AbortHandler(const AbortHandler& rhs);
84 * Assignment operator - undefined
86 AbortHandler& operator=(const AbortHandler& rhs);
89 typedef void (*SignalHandlerFuncPtr )( int );
91 // _NSIG comes from the signal.h linux system header, defining the number of signals.
92 SignalHandlerFuncPtr mSignalOldHandlers[_NSIG-1];
93 unsigned long long mSignalMask;
95 CallbackBase* mCallback;
97 static AbortHandler* gInstance;
100 } // Namespace Adaptor
101 } // Namespace Internal
104 #endif // __DALI_INTERNAL_ADAPTOR_ABORT_HANDLER_H__