コード例 #1
0
void MixerWorkerThread::JobQueue::run( sampleFrame * _buffer )
{
	bool processedJob = true;
	while( processedJob && (int) m_itemsDone < (int) m_queueSize )
	{
		processedJob = false;
		for( int i = 0; i < m_queueSize; ++i )
		{
			ThreadableJob * job = m_items[i].fetchAndStoreOrdered( NULL );
			if( job )
			{
				job->process( _buffer );
				processedJob = true;
				m_itemsDone.fetchAndAddOrdered( 1 );
			}
		}
		// always exit loop if we're not in dynamic mode
		processedJob = processedJob && ( m_opMode == Dynamic );
	}
}
コード例 #2
0
void MixerWorkerThread::JobQueue::run()
{
	bool processedJob = true;
	while (processedJob && m_itemsDone < m_writeIndex)
	{
		processedJob = false;
		for( int i = 0; i < m_writeIndex && i < JOB_QUEUE_SIZE; ++i )
		{
			ThreadableJob * job = m_items[i].exchange(nullptr);
			if( job )
			{
				job->process();
				processedJob = true;
				++m_itemsDone;
			}
		}
		// always exit loop if we're not in dynamic mode
		processedJob = processedJob && ( m_opMode == Dynamic );
	}
}