source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/util/Mutexes.hpp @ 2674

Revision 2674, 3.5 KB checked in by mattausch, 16 years ago (diff)
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 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22
23#if !defined(MUTEXES_HPP)
24#define MUTEXES_HPP
25
26#include <xercesc/util/XMemory.hpp>
27#include <xercesc/util/PlatformUtils.hpp>
28
29XERCES_CPP_NAMESPACE_BEGIN
30
31class XMLUTIL_EXPORT XMLMutex : public XMemory
32{
33public :
34    // -----------------------------------------------------------------------
35    //  Constructors and Destructor
36    // -----------------------------------------------------------------------
37    XMLMutex(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
38
39    ~XMLMutex();
40
41
42    // -----------------------------------------------------------------------
43    //  Lock control methods
44    // -----------------------------------------------------------------------
45    void lock();
46    void unlock();
47
48
49private :
50    // -----------------------------------------------------------------------
51    //  Unimplemented constructors and operators
52    // -----------------------------------------------------------------------
53    XMLMutex(const XMLMutex&);
54    XMLMutex& operator=(const XMLMutex&);
55
56
57    // -----------------------------------------------------------------------
58    //  Private data members
59    //
60    //  fHandle
61    //      The raw mutex handle. Its just a void pointer so we do not
62    //      pass judgement on its value at all. We just pass it into the
63    //      platform utilities methods which knows what's really in it.
64    // -----------------------------------------------------------------------
65    void*   fHandle;
66
67
68    // -----------------------------------------------------------------------
69    //  Sun PlatformUtils needs acess to fHandle to initialize the
70    //  atomicOpsMutex at startup.
71    // -----------------------------------------------------------------------
72    friend class XMLPlatformUtils;
73};
74
75
76class XMLUTIL_EXPORT XMLMutexLock : public XMemory
77{
78    // -----------------------------------------------------------------------
79    //  Constructors and Destructor
80    // -----------------------------------------------------------------------
81public:
82    XMLMutexLock(XMLMutex* const toLock);
83    ~XMLMutexLock();
84
85
86private :
87    // -----------------------------------------------------------------------
88    //  Unimplemented constructors and operators
89    // -----------------------------------------------------------------------
90    XMLMutexLock();
91    XMLMutexLock(const XMLMutexLock&);
92    XMLMutexLock& operator=(const XMLMutexLock&);
93
94
95    // -----------------------------------------------------------------------
96    //  Private data members
97    //
98    //  fToLock
99    //      The mutex object that we are locking
100    // -----------------------------------------------------------------------
101    XMLMutex*   fToLock;
102};
103
104XERCES_CPP_NAMESPACE_END
105
106#endif
Note: See TracBrowser for help on using the repository browser.