source: icXML/icXML-devel/src/xercesc/util/Mutexes.hpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 3.7 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: Mutexes.hpp 932887 2010-04-11 13:04:59Z borisk $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_MUTEXES_HPP)
23#define XERCESC_INCLUDE_GUARD_MUTEXES_HPP
24
25#include <xercesc/util/XMemory.hpp>
26#include <icxercesc/util/PlatformUtils.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30class XMLUTIL_EXPORT XMLMutex : public XMemory
31{
32public :
33    // -----------------------------------------------------------------------
34    //  Constructors and Destructor
35    // -----------------------------------------------------------------------
36    XMLMutex(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
37
38    ~XMLMutex();
39
40
41    // -----------------------------------------------------------------------
42    //  Lock control methods
43    // -----------------------------------------------------------------------
44    void lock();
45    void unlock();
46
47
48private :
49    // -----------------------------------------------------------------------
50    //  Unimplemented constructors and operators
51    // -----------------------------------------------------------------------
52    XMLMutex(const XMLMutex&);
53    XMLMutex& operator=(const XMLMutex&);
54
55
56    // -----------------------------------------------------------------------
57    //  Private data members
58    //
59    //  fHandle
60    //      The raw mutex handle. Its just a void pointer so we do not
61    //      pass judgement on its value at all. We just pass it into the
62    //      platform utilities methods which knows what's really in it.
63    // fManager
64    //      The MemoryManager that this XMLMutex was initialized with.
65    // -----------------------------------------------------------------------
66    void*          fHandle;
67    MemoryManager* fManager;
68
69
70    // -----------------------------------------------------------------------
71    //  Sun PlatformUtils needs access to fHandle to initialize the
72    //  atomicOpsMutex at startup.
73    // -----------------------------------------------------------------------
74    friend class XMLPlatformUtils;
75};
76
77
78class XMLUTIL_EXPORT XMLMutexLock : public XMemory
79{
80    // -----------------------------------------------------------------------
81    //  Constructors and Destructor
82    // -----------------------------------------------------------------------
83public:
84    XMLMutexLock(XMLMutex* const toLock);
85    ~XMLMutexLock();
86
87
88private :
89    // -----------------------------------------------------------------------
90    //  Unimplemented constructors and operators
91    // -----------------------------------------------------------------------
92    XMLMutexLock();
93    XMLMutexLock(const XMLMutexLock&);
94    XMLMutexLock& operator=(const XMLMutexLock&);
95
96
97    // -----------------------------------------------------------------------
98    //  Private data members
99    //
100    //  fToLock
101    //      The mutex object that we are locking
102    // -----------------------------------------------------------------------
103    XMLMutex*   fToLock;
104};
105
106XERCES_CPP_NAMESPACE_END
107
108#endif
Note: See TracBrowser for help on using the repository browser.