CFx SDK Documentation
2020SP3
|
Go to the documentation of this file.
24 #ifndef _THREADS_COUNTER_H_
25 #define _THREADS_COUNTER_H_
84 void set(
bool bEnable)
86 if(
m_mutex && (m_bEnable != bEnable))
119 virtual void increase(
unsigned ,
const unsigned* ,
unsigned ) { }
126 virtual void decrease(
unsigned ,
const unsigned* ,
unsigned ) { }
162 kMtLoadingAttributes = (1 << 0),
163 kMtRegenAttributes = (1 << 1),
164 kStRegenAttributes = (1 << 2),
165 kMtDisplayAttributes = (1 << 3),
166 kMtModelerAttributes = (1 << 4),
167 kAllAttributes = 0xFFFFFFFF
172 , m_mainThreadFunc(
NULL)
173 , m_threadPool(
NULL) { }
179 operator bool()
const {
return m_count > 1; }
224 { ++m_count; increaseProc(nThreads, aThreads, nThreadAttributes); }
230 void decrease(
unsigned nThreads,
const unsigned* aThreads)
231 { --m_count; decreaseProc(nThreads, aThreads); }
247 bool hasThread(
unsigned nThreadId,
unsigned *pThreadAttributes)
248 {
return hasThreadProc(nThreadId, pThreadAttributes); }
261 void increaseProc(
unsigned nThreads,
const unsigned* aThreads,
unsigned nThreadAttributes);
280 #define TD_AUTOLOCK_P(Mutex) OdMutexPtrAutoLock autoLock(Mutex);
281 #define TD_AUTOLOCK_P_DEF(Mutex) OdMutexPtrAutoLock autoLock(odThreadsCounter() ? Mutex.get() : NULL);
285 #endif //_THREADS_COUNTER_H_
FIRSTDLL_EXPORT unsigned odGetCurrentThreadId()
bool hasThread(unsigned nThreadId, unsigned *pThreadAttributes)
void increase(unsigned nThreads, const unsigned *aThreads, unsigned nThreadAttributes=ThreadsCounter::kNoAttributes)
void increaseProc(unsigned nThreads, const unsigned *aThreads, unsigned nThreadAttributes)
FIRSTDLL_EXPORT void odThreadYield()
void(* MainThreadFunc)(void *)
virtual void decrease(unsigned, const unsigned *, unsigned)
virtual void increase(unsigned, const unsigned *, unsigned)
bool removeReactor(ThreadsCounterReactor *pReactor)
virtual void stopThread(unsigned, unsigned)
ExecuteMainThreadFunc getMainThreadFunc()
OdRxThreadPoolService * m_threadPool
ExecuteMainThreadFunc m_mainThreadFunc
virtual ~ThreadsCounterReactor()
FIRSTDLL_EXPORT bool odExecuteMainThreadAction(MainThreadFunc mtFunc, void *pArg, bool bExecST=true)
void decrease(unsigned nThreads, const unsigned *aThreads)
void(* ExecuteMainThreadFunc)(MainThreadFunc, void *)
void setMainThreadFunc(ExecuteMainThreadFunc func)
OdRxThreadPoolService * getThreadPoolService()
void setThreadPoolService(OdRxThreadPoolService *pService)
bool hasReactor(ThreadsCounterReactor *pReactor) const
OdMutexPtrAutoLock(OdMutex *mutex)
bool hasThreadProc(unsigned nThreadId, unsigned *pThreadAttributes)
FIRSTDLL_EXPORT ThreadsCounter & odThreadsCounter()
virtual void startThread(unsigned, unsigned)
void decreaseProc(unsigned nThreads, const unsigned *aThreads)
bool addReactor(ThreadsCounterReactor *pReactor)
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)