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.
22 #include "application.h"
32 * Class to listen to system signals and trigger an abort callback
35 * This class maintains a process wide singleton, as the signal(2) system
36 * call is process specific, not thread specific.
38 * Currently, this precludes having multiple DALi instances in the same process.
45 * @param[in] callback The function to call when abort signals occur
47 AbortHandler(boost::function<void(void)> callback);
55 * Add a signal you want to be handled by this abort handler.
56 * @param[in] signum The signal number (from signum.h)
57 * @return true if the signal handler was installed ok
59 bool AbortOnSignal( int signum );
63 * Signal handler - Called when signal is received.
64 * Stops the application.
66 static void SignalHandler( int signum );
69 * Default constructor - undefined
74 * Copy constructor - undefined
76 AbortHandler(const AbortHandler& rhs);
79 * Assignment operator - undefined
81 AbortHandler& operator=(const AbortHandler& rhs);
84 typedef void (*SignalHandlerFuncPtr )( int );
86 // _NSIG comes from the signal.h linux system header, defining the number of signals.
87 SignalHandlerFuncPtr mSignalOldHandlers[_NSIG-1];
88 unsigned long long mSignalMask;
90 boost::function<void(void)> mCallback;
92 static AbortHandler* gInstance;
95 } // Namespace Adaptor
96 } // Namespace Internal
99 #endif // __DALI_INTERNAL_ADAPTOR_ABORT_HANDLER_H__