24#ifndef _THREADS_COUNTER_H_
25#define _THREADS_COUNTER_H_
84 void set(
bool bEnable)
86 if(
m_mutex && (m_bEnable != bEnable))
134 virtual void increase(
unsigned ,
const unsigned* ,
unsigned ) { }
141 virtual void decrease(
unsigned ,
const unsigned* ,
unsigned ) { }
179 kMtLoadingAttributes = (1 << 0),
180 kMtRegenAttributes = (1 << 1),
181 kStRegenAttributes = (1 << 2),
182 kMtDisplayAttributes = (1 << 3),
183 kMtModelerAttributes = (1 << 4),
184 kAllAttributes = 0xFFFFFFFF
189 , m_mainThreadFunc(NULL)
190 , m_threadPool(NULL) { }
196 operator bool()
const {
return m_count > 1; }
241 { ++m_count; increaseProc(nThreads, aThreads, nThreadAttributes); }
247 void decrease(
unsigned nThreads,
const unsigned* aThreads)
248 { --m_count; decreaseProc(nThreads, aThreads); }
264 bool hasThread(
unsigned nThreadId,
unsigned *pThreadAttributes)
265 {
return hasThreadProc(nThreadId, pThreadAttributes); }
278 void increaseProc(
unsigned nThreads,
const unsigned* aThreads,
unsigned nThreadAttributes);
297#define TD_AUTOLOCK_P(Mutex) OdMutexPtrAutoLock autoLock(Mutex);
298#define TD_AUTOLOCK_P_DEF(Mutex) OdMutexPtrAutoLock autoLock(odThreadsCounter() ? Mutex.get() : NULL);
FIRSTDLL_EXPORT void odThreadYield()
void(* ExecuteMainThreadFunc)(MainThreadFunc, void *)
FIRSTDLL_EXPORT bool odExecuteMainThreadAction(MainThreadFunc mtFunc, void *pArg, bool bExecST=true)
void(* MainThreadFunc)(void *)
FIRSTDLL_EXPORT ThreadsCounter & odThreadsCounter()
FIRSTDLL_EXPORT unsigned odGetCurrentThreadId()
OdMutexPtrAutoLock(OdMutex *mutex)
void increaseProc(unsigned nThreads, const unsigned *aThreads, unsigned nThreadAttributes)
void setThreadPoolService(OdRxThreadPoolService *pService)
bool removeReactor(ThreadsCounterReactor *pReactor)
ExecuteMainThreadFunc m_mainThreadFunc
bool hasThreadProc(unsigned nThreadId, unsigned *pThreadAttributes)
OdRxThreadPoolService * getThreadPoolService()
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)