reSIProcate/rutil  9694
Mutex.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_MUTEX_HXX)
00002 #define RESIP_MUTEX_HXX
00003 
00004 #include "rutil/compat.hxx"
00005 #include "rutil/Lockable.hxx"
00006 
00007 
00008 namespace resip
00009 {
00010 class Condition;
00011 
00034 class Mutex : public Lockable
00035 {
00036       friend class Condition;
00037 
00038    public:
00039       Mutex();
00040       virtual ~Mutex();
00041       virtual void lock();
00042       virtual void unlock();
00043 
00044    private:
00045       // !kh!
00046       //  no value sematics, therefore private and not implemented.
00047       Mutex (const Mutex&);
00048       Mutex& operator= (const Mutex&);
00049 
00050    private:
00051 #ifdef WIN32
00052           CRITICAL_SECTION mId;
00053 #else
00054       mutable  pthread_mutex_t mId;
00055       pthread_mutex_t* getId() const;
00056 #endif
00057 };
00058 
00059 }
00060 
00061 #endif
00062 
00063 /* ====================================================================
00064  * The Vovida Software License, Version 1.0
00065  *
00066  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00067  *
00068  * Redistribution and use in source and binary forms, with or without
00069  * modification, are permitted provided that the following conditions
00070  * are met:
00071  *
00072  * 1. Redistributions of source code must retain the above copyright
00073  *    notice, this list of conditions and the following disclaimer.
00074  *
00075  * 2. Redistributions in binary form must reproduce the above copyright
00076  *    notice, this list of conditions and the following disclaimer in
00077  *    the documentation and/or other materials provided with the
00078  *    distribution.
00079  *
00080  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00081  *    and "Vovida Open Communication Application Library (VOCAL)" must
00082  *    not be used to endorse or promote products derived from this
00083  *    software without prior written permission. For written
00084  *    permission, please contact vocal@vovida.org.
00085  *
00086  * 4. Products derived from this software may not be called "VOCAL", nor
00087  *    may "VOCAL" appear in their name, without prior written
00088  *    permission of Vovida Networks, Inc.
00089  *
00090  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00091  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00092  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00093  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00094  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00095  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00096  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00097  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00098  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00099  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00100  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00101  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00102  * DAMAGE.
00103  *
00104  * ====================================================================
00105  *
00106  * This software consists of voluntary contributions made by Vovida
00107  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00108  * Inc.  For more information on Vovida Networks, Inc., please see
00109  * <http://www.vovida.org/>.
00110  *
00111  */