E:/p4/sw/physx/PxShared/1.0/trunk/src/foundation/include/PsSync.h
Go to the documentation of this file.00001 // This code contains NVIDIA Confidential Information and is disclosed to you 00002 // under a form of NVIDIA software license agreement provided separately to you. 00003 // 00004 // Notice 00005 // NVIDIA Corporation and its licensors retain all intellectual property and 00006 // proprietary rights in and to this software and related documentation and 00007 // any modifications thereto. Any use, reproduction, disclosure, or 00008 // distribution of this software and related documentation without an express 00009 // license agreement from NVIDIA Corporation is strictly prohibited. 00010 // 00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES 00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO 00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, 00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. 00015 // 00016 // Information and code furnished is believed to be accurate and reliable. 00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such 00018 // information or for any infringement of patents or other rights of third parties that may 00019 // result from its use. No license is granted by implication or otherwise under any patent 00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice. 00021 // This code supersedes and replaces all information previously supplied. 00022 // NVIDIA Corporation products are not authorized for use as critical 00023 // components in life support devices or systems without express written approval of 00024 // NVIDIA Corporation. 00025 // 00026 // Copyright (c) 2008-2014 NVIDIA Corporation. All rights reserved. 00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. 00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. 00029 00030 #ifndef PSFOUNDATION_PSSYNC_H 00031 #define PSFOUNDATION_PSSYNC_H 00032 00033 #include "PsAllocator.h" 00034 00035 namespace physx 00036 { 00037 namespace shdfnd 00038 { 00048 class PX_FOUNDATION_API SyncImpl 00049 { 00050 public: 00051 static const uint32_t waitForever = 0xffffffff; 00052 00053 SyncImpl(); 00054 00055 ~SyncImpl(); 00056 00062 bool wait(uint32_t milliseconds = waitForever); 00063 00066 void set(); 00067 00070 void reset(); 00071 00075 static const uint32_t& getSize(); 00076 }; 00077 00087 template <typename Alloc = ReflectionAllocator<SyncImpl> > 00088 class SyncT : protected Alloc 00089 { 00090 public: 00091 static const uint32_t waitForever = SyncImpl::waitForever; 00092 00093 SyncT(const Alloc& alloc = Alloc()) : Alloc(alloc) 00094 { 00095 mImpl = reinterpret_cast<SyncImpl*>(Alloc::allocate(SyncImpl::getSize(), __FILE__, __LINE__)); 00096 PX_PLACEMENT_NEW(mImpl, SyncImpl)(); 00097 } 00098 00099 ~SyncT() 00100 { 00101 mImpl->~SyncImpl(); 00102 Alloc::deallocate(mImpl); 00103 } 00104 00110 bool wait(uint32_t milliseconds = SyncImpl::waitForever) 00111 { 00112 return mImpl->wait(milliseconds); 00113 } 00114 00117 void set() 00118 { 00119 mImpl->set(); 00120 } 00121 00124 void reset() 00125 { 00126 mImpl->reset(); 00127 } 00128 00129 private: 00130 class SyncImpl* mImpl; 00131 }; 00132 00133 typedef SyncT<> Sync; 00134 00135 } // namespace shdfnd 00136 } // namespace physx 00137 00138 #endif // #ifndef PSFOUNDATION_PSSYNC_H
Generated on Tue Jul 28 14:21:55 2015 for NVIDIA(R) PsFoundation Reference by
