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);
FIRSTDLL_EXPORT ThreadsCounter & odThreadsCounter()
FIRSTDLL_EXPORT void odThreadYield()
void(* ExecuteMainThreadFunc)(MainThreadFunc, void *)
FIRSTDLL_EXPORT bool odExecuteMainThreadAction(MainThreadFunc mtFunc, void *pArg, bool bExecST=true)
void(* MainThreadFunc)(void *)
FIRSTDLL_EXPORT unsigned odGetCurrentThreadId()
OdMutexPtrAutoLock(OdMutex *mutex)
void increaseProc(unsigned nThreads, const unsigned *aThreads, unsigned nThreadAttributes)
OdRxThreadPoolService * getThreadPoolService()
void setThreadPoolService(OdRxThreadPoolService *pService)
bool removeReactor(ThreadsCounterReactor *pReactor)
ExecuteMainThreadFunc m_mainThreadFunc
bool hasThreadProc(unsigned nThreadId, unsigned *pThreadAttributes)
ExecuteMainThreadFunc getMainThreadFunc()
void setMainThreadFunc(ExecuteMainThreadFunc func)
void decreaseProc(unsigned nThreads, const unsigned *aThreads)
OdRxThreadPoolService * m_threadPool
bool hasReactor(ThreadsCounterReactor *pReactor) const
bool hasThread(unsigned nThreadId, unsigned *pThreadAttributes)
void decrease(unsigned nThreads, const unsigned *aThreads)
void increase(unsigned nThreads, const unsigned *aThreads, unsigned nThreadAttributes=ThreadsCounter::kNoAttributes)
bool addReactor(ThreadsCounterReactor *pReactor)
virtual ~ThreadsCounterReactor()
virtual void decrease(unsigned, const unsigned *, unsigned)
virtual void startThread(unsigned, unsigned)
virtual void increase(unsigned, const unsigned *, unsigned)
virtual void stopThread(unsigned, unsigned)
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)