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 Flora License, Version 1.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://floralicense.org/license/
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.
21 #include "public-api/adaptor-framework/application.h"
31 * Class to listen to system signals and trigger an abort callback
34 * This class maintains a process wide singleton, as the signal(2) system
35 * call is process specific, not thread specific.
37 * Currently, this precludes having multiple DALi instances in the same process.
44 * @param[in] callback The function to call when abort signals occur
46 AbortHandler(boost::function<void(void)> callback);
54 * Add a signal you want to be handled by this abort handler.
55 * @param[in] signum The signal number (from signum.h)
56 * @return true if the signal handler was installed ok
58 bool AbortOnSignal( int signum );
62 * Signal handler - Called when signal is received.
63 * Stops the application.
65 static void SignalHandler( int signum );
68 * Default constructor - undefined
73 * Copy constructor - undefined
75 AbortHandler(const AbortHandler& rhs);
78 * Assignment operator - undefined
80 AbortHandler& operator=(const AbortHandler& rhs);
83 typedef void (*SignalHandlerFuncPtr )( int );
85 // _NSIG comes from the signal.h linux system header, defining the number of signals.
86 SignalHandlerFuncPtr mSignalOldHandlers[_NSIG-1];
87 unsigned long long mSignalMask;
89 boost::function<void(void)> mCallback;
91 static AbortHandler* gInstance;
94 } // Namespace Adaptor
95 } // Namespace Internal
98 #endif // __DALI_INTERNAL_ADAPTOR_ABORT_HANDLER_H__