CFx SDK Documentation
2020SP3
|
Go to the documentation of this file.
24 #ifndef _ODRXTHREADPOOLSERVICE_INCLUDED_
25 #define _ODRXTHREADPOOLSERVICE_INCLUDED_
73 virtual unsigned int getId()
const = 0;
647 for(
int i=0; i<n; ++i ) {
668 return next( threadIndex, itemIndex );
678 OdMutex* mutex = mutexForNext();
680 while(
void* pItem = sync_next( mutex, (
OdUInt32)threadIndex, itemIndex ) ) {
681 doAction( (
OdUInt32)threadIndex, itemIndex, pItem );
703 template<
class It,
class Fn >
709 bool next( It& cur ) {
711 if ( m_cur < m_last ) {
725 while( next( cur ) );
730 unsigned long n = last-first;
731 if( pQueue && n>1 ) {
737 n = ( n < numCPUs ) ? n : numCPUs;
744 std::for_each( first, last, fn );
750 template<
class It,
class Fn >
759 template<
class TObject >
768 template<
class TObject,
class TInitFn = OdApcObjectPoolHelperDummyInitFn<TObject> >
781 m_pEntries = ::new TObject[n];
784 TObject& obj = m_pEntries[ n ];
793 m_pEntries = ::new TObject[1];
795 (*pInitFn)( *m_pEntries );
802 return static_cast<TObject*
>(
get()->take().get() );
813 return m_pEntries[i];
824 #endif //_ODRXTHREADPOOLSERVICE_INCLUDED_
OdSmartPtr< OdApcQueue > OdApcQueuePtr
virtual void passByMain()=0
virtual void apcEntryPoint(OdApcParamType pMessage)
virtual void unlockFromInside()=0
virtual void asyncProcCall(OdApcEntryPointRxObjParam ep, OdRxObject *parameter)=0
OdSmartPtr< OdRxThreadPoolService > OdRxThreadPoolServicePtr
virtual int numCPUs() const =0
virtual void executeMainThreadAction(MainThreadFunc mtFunc, void *pArg)=0
virtual void passByMainNoWait()=0
void(* MainThreadFunc)(void *)
virtual void addEntryPoint(OdApcAtom *pRecipient, OdApcParamType pMessage)=0
OdSmartPtr< OdApcEvent > OdApcEventPtr
OdApcQueueHelper(const OdRxObjectPtr &pObject)
virtual OdRxObjectPtr take()=0
virtual OdApcQueuePtr newMTQueue(unsigned nThreadAttributes=ThreadsCounter::kNoAttributes, int numThreads=0, OdUInt32 nFlags=kMtQueueNoFlags)=0
#define ODA_ASSERT_ONCE(exp)
virtual void setAtomPoolRef(OdApcObjectPool *pAtomPool)=0
void for_each(OdApcQueue *pQueue, It first, It last, Fn fn)
virtual void addEntryPoint(OdApcAtom *pRecipient, OdRxObject *pMessage=0)=0
virtual OdApcObjectPoolPtr newObjectPool()=0
virtual OdApcThreadPtr newThread()=0
void od_async_for_each(OdApcQueue *pQueue, It first, It last, Fn fn)
virtual OdRxThreadPoolService & framework()=0
ODRX_DECLARE_MEMBERS(OdRxThreadPoolService)
virtual void externalThreadStart()=0
OdSmartPtr< OdApcGateway > OdApcGatewayPtr
OdSmartPtr< OdApcThread > OdApcThreadPtr
virtual void waitAndReset()=0
virtual void passBySecondary()=0
void init(OdRxThreadPoolService *pTP, int n=0, const TInitFn *pInitFn=0)
virtual void apcEntryPoint(OdApcParamType threadIndex)
virtual int numThreads() const =0
void(* OdApcEntryPointVoidParam)(OdApcParamType parameter)
OdArray & setAt(size_type arrayIndex, const OdApcQueueHelper &value)
OdSmartPtr< OdApcAtom > OdApcAtomPtr
void initST(OdRxThreadPoolService *pThreadPool)
virtual OdApcQueuePtr newSTQueue()=0
virtual void init(OdUInt32 numThreads)=0
@ kMtQueueAllowExecByMain
virtual void put(OdRxObject *pObj)=0
virtual void unlockByMain()=0
virtual void reserve(OdUInt32 n)=0
virtual unsigned int getId() const =0
OdApcQueueHelper(OdRxObject *pObject, OdRxObjMod m)
void call(OdApcAtom *pAction, OdApcParamType param)
OdApcQueueHelper(const OdBaseObjectPtr &pObject)
void setAtomPoolRef(OdApcObjectPool *pAtomPool)
void initMT(OdRxThreadPoolService *pThreadPool)
void operator()(TObject &) const
virtual void waitByMain()=0
void call(OdApcAtom *pAction, OdRxObject *pParam=0)
void resize(size_type logicalLength, const OdApcQueueHelper &value)
void(* ExecuteMainThreadFunc)(MainThreadFunc, void *)
virtual void doAction(OdUInt32 threadIndex, OdUInt32 itemIndex, void *pItem)=0
virtual void setExternalMainThreadFunc(ExecuteMainThreadFunc execFunc)=0
@ kMtQueueForceNewThreads
virtual void lockByMain(OdUInt32 numThreads)=0
OdApcQueueHelper(const OdApcQueue *pObject, OdRxObjMod m)
OdApcQueueHelper & at(size_type arrayIndex)
void initST(int n, OdRxThreadPoolService *pTP)
virtual void externalThreadStop()=0
virtual void apcEntryPoint(OdRxObject *pMessage)
virtual OdApcLoopedGatewayPtr newLoopedGateway()=0
void for_each(OdApcQueue *pQueue, OdUInt32 nThreads=0)
virtual void lockFromInside()=0
OdApcQueueHelper(const OdRxObject *pObject)
OdApcQueueHelper(const OdSmartPtr< OdApcQueue > &pObject)
virtual int numPhysicalCores() const =0
virtual void executeMainThreadAction(MainThreadFunc mtFunc, void *pArg)=0
OdApcQueueHelper(const OdApcQueue *pObject)
virtual void * next(OdUInt32 threadIndex, OdUInt32 &itemIndex)=0
TObject & at(OdUInt32 i) const
OdSmartPtr< OdApcObjectPool > OdApcObjectPoolPtr
virtual void asyncProcCall(OdApcEntryPointVoidParam ep, OdApcParamType parameter)=0
virtual void unregisterExternalThreads(unsigned nThreads, const unsigned *aThreads)=0
void(* OdApcEntryPointRxObjParam)(OdRxObject *parameter)
virtual ExecuteMainThreadFunc getExternalMainThreadFunc() const =0
virtual void passBySecondary()=0
virtual OdApcEventPtr newEvent()=0
virtual OdMutex * mutexForNext()=0
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)
virtual void registerExternalThreads(unsigned nThreads, const unsigned *aThreads, unsigned nThreadAttribs=ThreadsCounter::kNoAttributes)=0
virtual OdApcGatewayPtr newGateway()=0
virtual void waitByMain()=0
virtual int numFreeThreads() const =0
OdSmartPtr< OdApcDataReadWriteDispatcher > OdApcDataReadWriteDispatcherPtr
OdSmartPtr< OdApcLoopedGateway > OdApcLoopedGatewayPtr