1 | /*
|
---|
2 | * Copyright 1999-2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Log: Mutexes.hpp,v $
|
---|
19 | * Revision 1.5 2004/09/08 13:56:22 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.4 2003/05/15 19:04:35 knoaman
|
---|
23 | * Partial implementation of the configurable memory manager.
|
---|
24 | *
|
---|
25 | * Revision 1.3 2003/03/07 18:11:54 tng
|
---|
26 | * Return a reference instead of void for operator=
|
---|
27 | *
|
---|
28 | * Revision 1.2 2002/11/04 15:22:04 tng
|
---|
29 | * C++ Namespace Support.
|
---|
30 | *
|
---|
31 | * Revision 1.1.1.1 2002/02/01 22:22:11 peiyongz
|
---|
32 | * sane_include
|
---|
33 | *
|
---|
34 | * Revision 1.4 2000/03/02 19:54:42 roddey
|
---|
35 | * This checkin includes many changes done while waiting for the
|
---|
36 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
37 | * available elsewhere.
|
---|
38 | *
|
---|
39 | * Revision 1.3 2000/02/24 20:05:24 abagchi
|
---|
40 | * Swat for removing Log from API docs
|
---|
41 | *
|
---|
42 | * Revision 1.2 2000/02/06 07:48:02 rahulj
|
---|
43 | * Year 2K copyright swat.
|
---|
44 | *
|
---|
45 | * Revision 1.1.1.1 1999/11/09 01:04:46 twl
|
---|
46 | * Initial checkin
|
---|
47 | *
|
---|
48 | * Revision 1.3 1999/11/08 20:45:10 rahul
|
---|
49 | * Swat for adding in Product name and CVS comment log variable.
|
---|
50 | *
|
---|
51 | */
|
---|
52 |
|
---|
53 |
|
---|
54 | #if !defined(MUTEXES_HPP)
|
---|
55 | #define MUTEXES_HPP
|
---|
56 |
|
---|
57 | #include <xercesc/util/XMemory.hpp>
|
---|
58 |
|
---|
59 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
60 |
|
---|
61 | class XMLUTIL_EXPORT XMLMutex : public XMemory
|
---|
62 | {
|
---|
63 | public :
|
---|
64 | // -----------------------------------------------------------------------
|
---|
65 | // Constructors and Destructor
|
---|
66 | // -----------------------------------------------------------------------
|
---|
67 | XMLMutex();
|
---|
68 |
|
---|
69 | ~XMLMutex();
|
---|
70 |
|
---|
71 |
|
---|
72 | // -----------------------------------------------------------------------
|
---|
73 | // Lock control methods
|
---|
74 | // -----------------------------------------------------------------------
|
---|
75 | void lock();
|
---|
76 | void unlock();
|
---|
77 |
|
---|
78 |
|
---|
79 | private :
|
---|
80 | // -----------------------------------------------------------------------
|
---|
81 | // Unimplemented constructors and operators
|
---|
82 | // -----------------------------------------------------------------------
|
---|
83 | XMLMutex(const XMLMutex&);
|
---|
84 | XMLMutex& operator=(const XMLMutex&);
|
---|
85 |
|
---|
86 |
|
---|
87 | // -----------------------------------------------------------------------
|
---|
88 | // Private data members
|
---|
89 | //
|
---|
90 | // fHandle
|
---|
91 | // The raw mutex handle. Its just a void pointer so we do not
|
---|
92 | // pass judgement on its value at all. We just pass it into the
|
---|
93 | // platform utilities methods which knows what's really in it.
|
---|
94 | // -----------------------------------------------------------------------
|
---|
95 | void* fHandle;
|
---|
96 |
|
---|
97 |
|
---|
98 | // -----------------------------------------------------------------------
|
---|
99 | // Sun PlatformUtils needs acess to fHandle to initialize the
|
---|
100 | // atomicOpsMutex at startup.
|
---|
101 | // -----------------------------------------------------------------------
|
---|
102 | friend class XMLPlatformUtils;
|
---|
103 | };
|
---|
104 |
|
---|
105 |
|
---|
106 | class XMLUTIL_EXPORT XMLMutexLock : public XMemory
|
---|
107 | {
|
---|
108 | // -----------------------------------------------------------------------
|
---|
109 | // Constructors and Destructor
|
---|
110 | // -----------------------------------------------------------------------
|
---|
111 | public:
|
---|
112 | XMLMutexLock(XMLMutex* const toLock);
|
---|
113 | ~XMLMutexLock();
|
---|
114 |
|
---|
115 |
|
---|
116 | private :
|
---|
117 | // -----------------------------------------------------------------------
|
---|
118 | // Unimplemented constructors and operators
|
---|
119 | // -----------------------------------------------------------------------
|
---|
120 | XMLMutexLock();
|
---|
121 | XMLMutexLock(const XMLMutexLock&);
|
---|
122 | XMLMutexLock& operator=(const XMLMutexLock&);
|
---|
123 |
|
---|
124 |
|
---|
125 | // -----------------------------------------------------------------------
|
---|
126 | // Private data members
|
---|
127 | //
|
---|
128 | // fToLock
|
---|
129 | // The mutex object that we are locking
|
---|
130 | // -----------------------------------------------------------------------
|
---|
131 | XMLMutex* fToLock;
|
---|
132 | };
|
---|
133 |
|
---|
134 | XERCES_CPP_NAMESPACE_END
|
---|
135 |
|
---|
136 | #endif
|
---|