MCPcopy Create free account
hub / github.com/carbonengine/trinity / WorkQueue2

Method WorkQueue2

shadercompiler/WorkQueue.h:125–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123{
124public:
125 WorkQueue2( size_t totalWorkerCount, size_t activeWorkersCount, Processor processor ) :
126 m_processor( processor )
127 {
128 m_totalWorkerCount = totalWorkerCount;
129 m_activeWorkersCount = activeWorkersCount;
130
131#ifdef __APPLE__
132 semaphore_create( current_task(), &m_activeWorkersSemaphore, SYNC_POLICY_FIFO, (int32_t)activeWorkersCount );
133#else
134 m_activeWorkersSemaphore = CreateSemaphore( NULL, (long)activeWorkersCount, (long)activeWorkersCount, NULL );
135 if( m_activeWorkersSemaphore == NULL )
136 {
137 g_messages.AddMessage( "WorkQueue2: Creating m_activeWorkersSemaphore failed! Error: %d", GetLastError() );
138 }
139#endif
140 started = false;
141
142 for( size_t i = 0; i < totalWorkerCount; ++i )
143 {
144 m_workerThreads.emplace_back( std::thread( [this] { WorkerThread(); } ) );
145 }
146 }
147
148 virtual ~WorkQueue2()
149 {

Callers

nothing calls this directly

Calls 1

AddMessageMethod · 0.80

Tested by

no test coverage detected