Panda3D
 All Classes Functions Variables Enumerations
mutexDirect.I
00001 // Filename: mutexDirect.I
00002 // Created by:  drose (13Feb06)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: MutexDirect::Constructor
00018 //       Access: Protected
00019 //  Description:
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE MutexDirect::
00022 MutexDirect() {
00023 }
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //     Function: MutexDirect::Destructor
00027 //       Access: Protected
00028 //  Description:
00029 ////////////////////////////////////////////////////////////////////
00030 INLINE MutexDirect::
00031 ~MutexDirect() {
00032 }
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //     Function: MutexDirect::Copy Constructor
00036 //       Access: Private
00037 //  Description: Do not attempt to copy mutexes.
00038 ////////////////////////////////////////////////////////////////////
00039 INLINE MutexDirect::
00040 MutexDirect(const MutexDirect &copy) {
00041   nassertv(false);
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: MutexDirect::Copy Assignment Operator
00046 //       Access: Private
00047 //  Description: Do not attempt to copy mutexes.
00048 ////////////////////////////////////////////////////////////////////
00049 INLINE void MutexDirect::
00050 operator = (const MutexDirect &copy) {
00051   nassertv(false);
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //     Function: MutexDirect::acquire
00056 //       Access: Published
00057 //  Description: Grabs the mutex if it is available.  If it is not
00058 //               available, blocks until it becomes available, then
00059 //               grabs it.  In either case, the function does not
00060 //               return until the mutex is held; you should then call
00061 //               unlock().
00062 //
00063 //               This method is considered const so that you can lock
00064 //               and unlock const mutexes, mainly to allow thread-safe
00065 //               access to otherwise const data.
00066 //
00067 //               Also see MutexHolder.
00068 ////////////////////////////////////////////////////////////////////
00069 INLINE void MutexDirect::
00070 acquire() const {
00071   TAU_PROFILE("void MutexDirect::acquire()", " ", TAU_USER);
00072   ((MutexDirect *)this)->_impl.acquire();
00073 }
00074 
00075 ////////////////////////////////////////////////////////////////////
00076 //     Function: MutexDirect::try_acquire
00077 //       Access: Published
00078 //  Description: Returns immediately, with a true value indicating the
00079 //               mutex has been acquired, and false indicating it has
00080 //               not.
00081 ////////////////////////////////////////////////////////////////////
00082 INLINE bool MutexDirect::
00083 try_acquire() const {
00084   TAU_PROFILE("void MutexDirect::acquire(bool)", " ", TAU_USER);
00085   return ((MutexDirect *)this)->_impl.try_acquire();
00086 }
00087 
00088 ////////////////////////////////////////////////////////////////////
00089 //     Function: MutexDirect::release
00090 //       Access: Published
00091 //  Description: Releases the mutex.  It is an error to call this if
00092 //               the mutex was not already locked.
00093 //
00094 //               This method is considered const so that you can lock
00095 //               and unlock const mutexes, mainly to allow thread-safe
00096 //               access to otherwise const data.
00097 ////////////////////////////////////////////////////////////////////
00098 INLINE void MutexDirect::
00099 release() const {
00100   TAU_PROFILE("void MutexDirect::release()", " ", TAU_USER);
00101   ((MutexDirect *)this)->_impl.release();
00102 }
00103 
00104 ////////////////////////////////////////////////////////////////////
00105 //     Function: MutexDirect::debug_is_locked
00106 //       Access: Published
00107 //  Description: Returns true if the current thread has locked the
00108 //               Mutex, false otherwise.  This method is only intended
00109 //               for use in debugging, hence the method name; in the
00110 //               MutexDirect case, it always returns true, since
00111 //               there's not a reliable way to determine this
00112 //               otherwise.
00113 ////////////////////////////////////////////////////////////////////
00114 INLINE bool MutexDirect::
00115 debug_is_locked() const {
00116   return true;
00117 }
00118 
00119 ////////////////////////////////////////////////////////////////////
00120 //     Function: MutexDirect::set_name
00121 //       Access: Public
00122 //  Description: The mutex name is only defined when compiling in
00123 //               DEBUG_THREADS mode.
00124 ////////////////////////////////////////////////////////////////////
00125 INLINE void MutexDirect::
00126 set_name(const string &) {
00127 }
00128 
00129 ////////////////////////////////////////////////////////////////////
00130 //     Function: MutexDirect::clear_name
00131 //       Access: Public
00132 //  Description: The mutex name is only defined when compiling in
00133 //               DEBUG_THREADS mode.
00134 ////////////////////////////////////////////////////////////////////
00135 INLINE void MutexDirect::
00136 clear_name() {
00137 }
00138 
00139 ////////////////////////////////////////////////////////////////////
00140 //     Function: MutexDirect::has_name
00141 //       Access: Public
00142 //  Description: The mutex name is only defined when compiling in
00143 //               DEBUG_THREADS mode.
00144 ////////////////////////////////////////////////////////////////////
00145 INLINE bool MutexDirect::
00146 has_name() const {
00147   return false;
00148 }
00149 
00150 ////////////////////////////////////////////////////////////////////
00151 //     Function: MutexDirect::get_name
00152 //       Access: Public
00153 //  Description: The mutex name is only defined when compiling in
00154 //               DEBUG_THREADS mode.
00155 ////////////////////////////////////////////////////////////////////
00156 INLINE string MutexDirect::
00157 get_name() const {
00158   return string();
00159 }
 All Classes Functions Variables Enumerations