00001 // Filename: pmutex.h 00002 // Created by: cary (16Sep98) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef PMUTEX_H 00020 #define PMUTEX_H 00021 00022 #include "pandabase.h" 00023 #include "mutexImpl.h" 00024 #include "notify.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : Mutex 00028 // Description : A standard mutex, or mutual exclusion lock. Only one 00029 // thread can hold ("lock") a mutex at any given time; 00030 // other threads trying to grab the mutex will block 00031 // until the holding thread releases it. 00032 //////////////////////////////////////////////////////////////////// 00033 class EXPCL_PANDAEXPRESS Mutex { 00034 public: 00035 INLINE Mutex(); 00036 INLINE ~Mutex(); 00037 private: 00038 INLINE Mutex(const Mutex ©); 00039 INLINE void operator = (const Mutex ©); 00040 00041 public: 00042 INLINE void lock() const; 00043 INLINE void release() const; 00044 00045 private: 00046 MutexImpl _impl; 00047 friend class ConditionVar; 00048 }; 00049 00050 #include "pmutex.I" 00051 00052 #endif