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 #include <vos/diagnose.hxx>
25 #include <vos/object.hxx>
26 #include <vos/mutex.hxx>
27
28 using namespace vos;
29
30 /////////////////////////////////////////////////////////////////////////////
31 //
32 // class Mutex
33 //
34
35 VOS_IMPLEMENT_CLASSINFO(VOS_CLASSNAME(OMutex, vos), VOS_NAMESPACE(OMutex, vos), VOS_NAMESPACE(OObject, vos), 0);
36
getGlobalMutex()37 IMutex& OMutex::getGlobalMutex()
38 {
39 static OMutex theGlobalMutex;
40
41 return theGlobalMutex;
42 }
43
OMutex()44 OMutex::OMutex()
45 {
46 m_Impl= osl_createMutex();
47 }
48
~OMutex()49 OMutex::~OMutex()
50 {
51 osl_destroyMutex(m_Impl);
52 }
53
acquire()54 void OMutex::acquire()
55 {
56 osl_acquireMutex(m_Impl);
57 }
58
tryToAcquire()59 sal_Bool OMutex::tryToAcquire()
60 {
61 return osl_tryToAcquireMutex(m_Impl);
62 }
63
release()64 void OMutex::release()
65 {
66 osl_releaseMutex(m_Impl);
67 }
68
69