Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013 #ifndef _FBXSDK_CORE_SYNC_H_
00014 #define _FBXSDK_CORE_SYNC_H_
00015
00016 #include <fbxsdk/fbxsdk_def.h>
00017
00018 #include <fbxsdk/core/sync/fbxclock.h>
00019 #include <fbxsdk/core/sync/fbxthread.h>
00020
00021 #include <fbxsdk/fbxsdk_nsbegin.h>
00022
00023 class FbxMutexImpl;
00024 class FbxSemaphoreImpl;
00025 class FbxGateImpl;
00026
00036 class FBXSDK_DLL FbxSpinLock
00037 {
00038 public:
00039 FbxSpinLock();
00040
00042 void Acquire();
00043
00045 void Release();
00046
00047 private:
00048 FbxAtomic mSpinLock;
00049 };
00050
00057 class FBXSDK_DLL FbxMutex
00058 {
00059 public:
00064 FbxMutex(bool pInitialOwnership=false);
00065 virtual ~FbxMutex();
00066
00070 void Acquire();
00071
00077 bool TryAcquire(unsigned int pRetryCount);
00078
00083 void Release();
00084
00085 private:
00086 FbxMutexImpl* mImpl;
00087 };
00088
00094 class FBXSDK_DLL FbxSemaphore
00095 {
00096 public:
00097 FbxSemaphore();
00098 virtual ~FbxSemaphore();
00099
00105 bool Wait(unsigned int pCount=1);
00106
00111 bool Signal(unsigned int pCount=1);
00112
00113 private:
00114 FbxSemaphoreImpl* mImpl;
00115 };
00116
00121 class FBXSDK_DLL FbxGate
00122 {
00123 public:
00124 FbxGate();
00125 virtual ~FbxGate();
00126
00130 void Open();
00131
00133 void Close();
00134
00138 bool IsOpen();
00139
00144 bool Wait();
00145
00146 private:
00147 FbxGateImpl* mImpl;
00148 };
00149
00152 class FBXSDK_DLL FbxSyncStack
00153 {
00154 public:
00156 struct Item
00157 {
00158 Item* mNext;
00159 inline Item(){ mNext = NULL; }
00160 inline Item* Set(Item* pNext){ return mNext = pNext; }
00161 inline Item* Next(){ return mNext; }
00162 };
00163
00165 FbxSyncStack();
00166
00170 void Push(Item* pItem);
00171
00175 Item* Pop();
00176
00177 private:
00178 FbxSpinLock mLock;
00179 Item* mTop;
00180 };
00181
00182 #include <fbxsdk/fbxsdk_nsend.h>
00183
00184 #endif