コード例 #1
0
ファイル: JobQueue.cpp プロジェクト: Ikesters/pioneer
// call OnFinish methods for completed jobs, and clean up
Uint32 AsyncJobQueue::FinishJobs()
{
	PROFILE_SCOPED()
	Uint32 finished = 0;

	const uint32_t numRunners = m_runners.size();
	for( uint32_t i=0; i<numRunners ; ++i) {
		SDL_LockMutex(m_finishedLock[i]);
		if( m_finished[i].empty() ) {
			SDL_UnlockMutex(m_finishedLock[i]);
			continue;
		}
		Job *job = m_finished[i].front();
		m_finished[i].pop_front();
		SDL_UnlockMutex(m_finishedLock[i]);

		assert(job);

		// if its already been cancelled then its taken care of, so we just forget about it
		if(!job->cancelled) {
			job->UnlinkHandle();
			job->OnFinish();
			finished++;
		}

		delete job;
	}

	return finished;
}
コード例 #2
0
ファイル: JobQueue.cpp プロジェクト: Ikesters/pioneer
// call OnFinish methods for completed jobs, and clean up
Uint32 SyncJobQueue::FinishJobs()
{
	PROFILE_SCOPED()
	Uint32 finished = 0;

	while (!m_finished.empty()) {
		Job *job = m_finished.front();
		m_finished.pop_front();

		// if its already been cancelled then its taken care of, so we just forget about it
		if(!job->cancelled) {
			job->UnlinkHandle();
			job->OnFinish();
			finished++;
		}

		delete job;
	}
	return finished;
}