xref: /aoo42x/main/vos/source/signal.cxx (revision e8c8fa4b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #include <vos/diagnose.hxx>
26 #include <vos/object.hxx>
27 #include <vos/signal.hxx>
28 
29 using namespace vos;
30 
signalHandlerFunction_impl(void * pthis,oslSignalInfo * pInfo)31 oslSignalAction vos::signalHandlerFunction_impl(
32     void * pthis, oslSignalInfo * pInfo)
33 {
34 	vos::OSignalHandler* pThis= (vos::OSignalHandler*)pthis;
35 
36 	return ((oslSignalAction)pThis->signal(pInfo));
37 }
38 
39 /////////////////////////////////////////////////////////////////////////////
40 // Thread class
41 
42 VOS_IMPLEMENT_CLASSINFO(VOS_CLASSNAME(OSignalHandler, vos),
43 						VOS_NAMESPACE(OSignalHandler, vos),
44 						VOS_NAMESPACE(OObject, vos), 0);
45 
OSignalHandler()46 OSignalHandler::OSignalHandler()
47 {
48 	m_hHandler = osl_addSignalHandler(signalHandlerFunction_impl, this);
49 }
50 
~OSignalHandler()51 OSignalHandler::~OSignalHandler()
52 {
53 	osl_removeSignalHandler(m_hHandler);
54 }
55 
raise(sal_Int32 Signal,void * pData)56 OSignalHandler::TSignalAction OSignalHandler::raise(sal_Int32 Signal, void *pData)
57 {
58 	return (TSignalAction)osl_raiseSignal(Signal, pData);
59 }
60 
61