- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# fbxsync.h

Go to the documentation of this file.

    00001 /****************************************************************************************
    00002
    00003    Copyright (C) 2013 Autodesk, Inc.
    00004    All rights reserved.
    00005
    00006    Use of this software is subject to the terms of the Autodesk license agreement
    00007    provided at the time of installation or download, or which otherwise accompanies
    00008    this software in either electronic or hard copy form.
    00009
    00010 ****************************************************************************************/
    00011
    00013 #ifndef _FBXSDK_CORE_SYNC_H_
    00014 #define _FBXSDK_CORE_SYNC_H_
    00015
    00016 #include <fbxsdk/fbxsdk_def.h>
    00017
    00018 #ifndef FBXSDK_ENV_WINRT
    00019
    00020 #include <fbxsdk/core/sync/fbxclock.h>
    00021 #include <fbxsdk/core/sync/fbxthread.h>
    00022
    00023 #include <fbxsdk/fbxsdk_nsbegin.h>
    00024
    00025 class FbxMutexImpl;
    00026 class FbxSemaphoreImpl;
    00027 class FbxGateImpl;
    00028
    00038 class FBXSDK_DLL FbxSpinLock
    00039 {
    00040 public:
    00041     FbxSpinLock();
    00042
    00044     void Acquire();
    00045
    00047     void Release();
    00048
    00049 private:
    00050     FbxAtomic mSpinLock;
    00051 };
    00052
    00059 class FBXSDK_DLL FbxMutex
    00060 {
    00061 public:
    00066     FbxMutex(bool pInitialOwnership=false);
    00067     virtual ~FbxMutex();
    00068
    00072     void Acquire();
    00073
    00079     bool TryAcquire(unsigned int pRetryCount);
    00080
    00085     void Release();
    00086
    00087 private:
    00088     FbxMutexImpl* mImpl;
    00089 };
    00090
    00096 class FBXSDK_DLL FbxSemaphore
    00097 {
    00098 public:
    00099     FbxSemaphore();
    00100     virtual ~FbxSemaphore();
    00101
    00107     bool Wait(unsigned int pCount=1);
    00108
    00113     bool Signal(unsigned int pCount=1);
    00114
    00115 private:
    00116     FbxSemaphoreImpl* mImpl;
    00117 };
    00118
    00123 class FBXSDK_DLL FbxGate
    00124 {
    00125 public:
    00126     FbxGate();
    00127     virtual ~FbxGate();
    00128
    00132     void Open();
    00133
    00135     void Close();
    00136
    00140     bool IsOpen();
    00141
    00146     bool Wait();
    00147
    00148 private:
    00149     FbxGateImpl* mImpl;
    00150 };
    00151
    00154 class FBXSDK_DLL FbxSyncStack
    00155 {
    00156 public:
    00158     struct Item
    00159     {
    00160         Item* mNext;
    00161         inline Item(){ mNext = NULL; }
    00162         inline Item* Set(Item* pNext){ return mNext = pNext; }
    00163         inline Item* Next(){ return mNext; }
    00164     };
    00165
    00167     FbxSyncStack();
    00168
    00172     void Push(Item* pItem);
    00173
    00177     Item* Pop();
    00178
    00179 private:
    00180     FbxSpinLock mLock;
    00181     Item*       mTop;
    00182 };
    00183
    00184 #include <fbxsdk/fbxsdk_nsend.h>
    00185
    00186 #endif /* !FBXSDK_ENV_WINRT */
    00187
    00188 #endif /* _FBXSDK_CORE_SYNC_H_ */