本文整理汇总了C++中List::AddBack方法的典型用法代码示例。如果您正苦于以下问题:C++ List::AddBack方法的具体用法?C++ List::AddBack怎么用?C++ List::AddBack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类List
的用法示例。
在下文中一共展示了List::AddBack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QueueUnchecked
bool QueueUnchecked(Job job)
{
job->m_sheduler = this;
m_lock.lock();
m_jobQueue.AddBack(job);
m_lock.unlock();
return true;
}
示例2: m_JobThread
// Single job thread
void m_JobThread(JobThread* myThread)
{
while(!myThread->terminate)
{
if(!m_jobQueue.empty())
{
m_lock.lock();
if(!m_jobQueue.empty())
{
myThread->idleDuration.Restart();
// Process a job
Job peekJob = m_jobQueue.front();
if((peekJob->jobFlags & JobFlags::IO) != JobFlags::IO || (myThread->index != 0)) // Only perform IO on first thread
{
myThread->activeJob = m_jobQueue.PopFront();
m_lock.unlock();
// Run
myThread->activeJob->m_ret = myThread->activeJob->Run();
myThread->activeJob->m_finished = true;
// Add to finished queue
m_lock.lock();
m_finishedJobs.AddBack(myThread->activeJob);
m_lock.unlock();
// Clear the active job
myThread->activeJob.Release();
}
else
{
m_lock.unlock();
}
}
else
{
// Just do nothing
m_lock.unlock();
}
}
// Various idle levels
if(myThread->idleDuration.Minutes() > 1)
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
if(myThread->idleDuration.Seconds() > 1)
std::this_thread::sleep_for(std::chrono::milliseconds(500));
else
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}