00001 // Filename: mutexNsprImpl.I 00002 // Created by: drose (08Aug02) 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: MutexNsprImpl::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE MutexNsprImpl:: 00026 MutexNsprImpl() { 00027 _lock = PR_NewLock(); 00028 nassertv(_lock != (PRLock *)NULL); 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: MutexNsprImpl::Destructor 00033 // Access: Public 00034 // Description: 00035 //////////////////////////////////////////////////////////////////// 00036 INLINE MutexNsprImpl:: 00037 ~MutexNsprImpl() { 00038 PR_DestroyLock(_lock); 00039 } 00040 00041 //////////////////////////////////////////////////////////////////// 00042 // Function: MutexNsprImpl::lock 00043 // Access: Public 00044 // Description: 00045 //////////////////////////////////////////////////////////////////// 00046 INLINE void MutexNsprImpl:: 00047 lock() { 00048 PR_Lock(_lock); 00049 } 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Function: MutexNsprImpl::release 00053 // Access: Public 00054 // Description: 00055 //////////////////////////////////////////////////////////////////// 00056 INLINE void MutexNsprImpl:: 00057 release() { 00058 int status = PR_Unlock(_lock); 00059 nassertv(status == PR_SUCCESS); 00060 }