secureswitools/swisistools/source/xmlparser/xerces/include/xercesc/util/Mutexes.hpp
changeset 0 ba25891c3a9e
child 1 c42dffbd5b4f
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 /*
       
    18  * Licensed to the Apache Software Foundation (ASF) under one or more
       
    19  * contributor license agreements.  See the NOTICE file distributed with
       
    20  * this work for additional information regarding copyright ownership.
       
    21  * The ASF licenses this file to You under the Apache License, Version 2.0
       
    22  * (the "License"); you may not use this file except in compliance with
       
    23  * the License.  You may obtain a copy of the License at
       
    24  * 
       
    25  *      http://www.apache.org/licenses/LICENSE-2.0
       
    26  * 
       
    27  * Unless required by applicable law or agreed to in writing, software
       
    28  * distributed under the License is distributed on an "AS IS" BASIS,
       
    29  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    30  * See the License for the specific language governing permissions and
       
    31  * limitations under the License.
       
    32  */
       
    33 
       
    34 /*
       
    35  * $Id: Mutexes.hpp 568078 2007-08-21 11:43:25Z amassari $
       
    36  */
       
    37 
       
    38 
       
    39 #if !defined(MUTEXES_HPP)
       
    40 #define MUTEXES_HPP
       
    41 
       
    42 #include <xercesc/util/XMemory.hpp>
       
    43 #include <xercesc/util/PlatformUtils.hpp>
       
    44 
       
    45 XERCES_CPP_NAMESPACE_BEGIN
       
    46 
       
    47 class XMLUTIL_EXPORT XMLMutex : public XMemory
       
    48 {
       
    49 public :
       
    50     // -----------------------------------------------------------------------
       
    51     //  Constructors and Destructor
       
    52     // -----------------------------------------------------------------------
       
    53     XMLMutex(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       
    54 
       
    55     ~XMLMutex();
       
    56 
       
    57 
       
    58     // -----------------------------------------------------------------------
       
    59     //  Lock control methods
       
    60     // -----------------------------------------------------------------------
       
    61     void lock();
       
    62     void unlock();
       
    63 
       
    64 
       
    65 private :
       
    66     // -----------------------------------------------------------------------
       
    67     //  Unimplemented constructors and operators
       
    68     // -----------------------------------------------------------------------
       
    69     XMLMutex(const XMLMutex&);
       
    70     XMLMutex& operator=(const XMLMutex&);
       
    71 
       
    72 
       
    73     // -----------------------------------------------------------------------
       
    74     //  Private data members
       
    75     //
       
    76     //  fHandle
       
    77     //      The raw mutex handle. Its just a void pointer so we do not
       
    78     //      pass judgement on its value at all. We just pass it into the
       
    79     //      platform utilities methods which knows what's really in it.
       
    80     // -----------------------------------------------------------------------
       
    81     void*   fHandle;
       
    82 
       
    83 
       
    84     // -----------------------------------------------------------------------
       
    85     //  Sun PlatformUtils needs acess to fHandle to initialize the
       
    86     //  atomicOpsMutex at startup.
       
    87     // -----------------------------------------------------------------------
       
    88     friend class XMLPlatformUtils;
       
    89 };
       
    90 
       
    91 
       
    92 class XMLUTIL_EXPORT XMLMutexLock : public XMemory
       
    93 {
       
    94     // -----------------------------------------------------------------------
       
    95     //  Constructors and Destructor
       
    96     // -----------------------------------------------------------------------
       
    97 public:
       
    98     XMLMutexLock(XMLMutex* const toLock);
       
    99     ~XMLMutexLock();
       
   100 
       
   101 
       
   102 private :
       
   103     // -----------------------------------------------------------------------
       
   104     //  Unimplemented constructors and operators
       
   105     // -----------------------------------------------------------------------
       
   106     XMLMutexLock();
       
   107     XMLMutexLock(const XMLMutexLock&);
       
   108     XMLMutexLock& operator=(const XMLMutexLock&);
       
   109 
       
   110 
       
   111     // -----------------------------------------------------------------------
       
   112     //  Private data members
       
   113     //
       
   114     //  fToLock
       
   115     //      The mutex object that we are locking
       
   116     // -----------------------------------------------------------------------
       
   117     XMLMutex*   fToLock;
       
   118 };
       
   119 
       
   120 XERCES_CPP_NAMESPACE_END
       
   121 
       
   122 #endif