1/*
2 * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10
11
12#ifndef PX_PROFILE_EVENT_MUTEX_H
13#define PX_PROFILE_EVENT_MUTEX_H
14
15#include "physxprofilesdk/PxProfileBase.h"
16
17namespace physx {
18
19 /**
20 * Mutex interface that hides implementation around lock and unlock.
21 * The event system locks the mutex for every interaction.
22 */
23 class PxProfileEventMutex
24 {
25 protected:
26 virtual ~PxProfileEventMutex(){}
27 public:
28 virtual void lock() = 0;
29 virtual void unlock() = 0;
30 };
31
32 /**
33 * Take any mutex type that implements lock and unlock and make an EventMutex out of it.
34 */
35 template<typename TMutexType>
36 struct PxProfileEventMutexImpl : public PxProfileEventMutex
37 {
38 TMutexType* mMutex;
39 PxProfileEventMutexImpl( TMutexType* inMtx ) : mMutex( inMtx ) {}
40 virtual void lock() { mMutex->lock(); }
41 virtual void unlock() { mMutex->unlock(); }
42 };
43
44}
45
46#endif // PX_PROFILE_EVENT_MUTEX_H
47