Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:24

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_MUTEXES_HPP)
0023 #define XERCESC_INCLUDE_GUARD_MUTEXES_HPP
0024 
0025 #include <xercesc/util/XMemory.hpp>
0026 #include <xercesc/util/PlatformUtils.hpp>
0027 
0028 XERCES_CPP_NAMESPACE_BEGIN
0029 
0030 class XMLUTIL_EXPORT XMLMutex : public XMemory
0031 {
0032 public :
0033     // -----------------------------------------------------------------------
0034     //  Constructors and Destructor
0035     // -----------------------------------------------------------------------
0036     XMLMutex(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0037 
0038     ~XMLMutex();
0039 
0040 
0041     // -----------------------------------------------------------------------
0042     //  Lock control methods
0043     // -----------------------------------------------------------------------
0044     void lock();
0045     void unlock();
0046 
0047 
0048 private :
0049     // -----------------------------------------------------------------------
0050     //  Unimplemented constructors and operators
0051     // -----------------------------------------------------------------------
0052     XMLMutex(const XMLMutex&);
0053     XMLMutex& operator=(const XMLMutex&);
0054 
0055 
0056     // -----------------------------------------------------------------------
0057     //  Private data members
0058     //
0059     //  fHandle
0060     //      The raw mutex handle. Its just a void pointer so we do not
0061     //      pass judgement on its value at all. We just pass it into the
0062     //      platform utilities methods which knows what's really in it.
0063     // fManager
0064     //      The MemoryManager that this XMLMutex was initialized with.
0065     // -----------------------------------------------------------------------
0066     void*          fHandle;
0067     MemoryManager* fManager;
0068 
0069 
0070     // -----------------------------------------------------------------------
0071     //  Sun PlatformUtils needs access to fHandle to initialize the
0072     //  atomicOpsMutex at startup.
0073     // -----------------------------------------------------------------------
0074     friend class XMLPlatformUtils;
0075 };
0076 
0077 
0078 class XMLUTIL_EXPORT XMLMutexLock : public XMemory
0079 {
0080     // -----------------------------------------------------------------------
0081     //  Constructors and Destructor
0082     // -----------------------------------------------------------------------
0083 public:
0084     XMLMutexLock(XMLMutex* const toLock);
0085     ~XMLMutexLock();
0086 
0087 
0088 private :
0089     // -----------------------------------------------------------------------
0090     //  Unimplemented constructors and operators
0091     // -----------------------------------------------------------------------
0092     XMLMutexLock();
0093     XMLMutexLock(const XMLMutexLock&);
0094     XMLMutexLock& operator=(const XMLMutexLock&);
0095 
0096 
0097     // -----------------------------------------------------------------------
0098     //  Private data members
0099     //
0100     //  fToLock
0101     //      The mutex object that we are locking
0102     // -----------------------------------------------------------------------
0103     XMLMutex*   fToLock;
0104 };
0105 
0106 XERCES_CPP_NAMESPACE_END
0107 
0108 #endif