本文整理汇总了C++中QueuedRequest类的典型用法代码示例。如果您正苦于以下问题:C++ QueuedRequest类的具体用法?C++ QueuedRequest怎么用?C++ QueuedRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QueuedRequest类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lockData
bool LLQueuedThread::completeRequest(handle_t handle)
{
bool res = false;
lockData();
QueuedRequest* req = (QueuedRequest*)mRequestHash.find(handle);
if (req)
{
llassert_always(req->getStatus() != STATUS_QUEUED);
llassert_always(req->getStatus() != STATUS_INPROGRESS);
#if _DEBUG
// LL_INFOS() << llformat("LLQueuedThread::Completed req [%08d]",handle) << LL_ENDL;
#endif
if (!(req->getFlags() & FLAG_LOCKED))
{
mRequestHash.erase(handle);
req->deleteRequest();
// check();
}
else
{
// Cause deletion immediately after FLAG_LOCKED is released.
req->setFlags(FLAG_AUTO_COMPLETE);
}
res = true;
}
unlockData();
return res;
}
示例2: lockData
// MAIN thread
void LLQueuedThread::printQueueStats()
{
lockData();
if (!mRequestQueue.empty())
{
QueuedRequest *req = *mRequestQueue.begin();
llinfos << llformat("Pending Requests:%d Current status:%d", mRequestQueue.size(), req->getStatus()) << llendl;
}
else
{
llinfos << "Queued Thread Idle" << llendl;
}
unlockData();
}
示例3: setQuitting
void LLQueuedThread::shutdown()
{
setQuitting();
unpause(); // MAIN THREAD
if (mThreaded)
{
S32 timeout = 100;
for ( ; timeout>0; timeout--)
{
if (isStopped())
{
break;
}
ms_sleep(100);
LLThread::yield();
}
if (timeout == 0)
{
llwarns << "~LLQueuedThread (" << mName << ") timed out!" << llendl;
}
}
else
{
mStatus = STOPPED;
}
QueuedRequest* req;
S32 active_count = 0;
while ( (req = (QueuedRequest*)mRequestHash.pop_element()) )
{
if (req->getStatus() == STATUS_QUEUED || req->getStatus() == STATUS_INPROGRESS)
{
++active_count;
req->setStatus(STATUS_ABORTED); // avoid assert in deleteRequest
}
req->deleteRequest();
}
if (active_count)
{
llwarns << "~LLQueuedThread() called with active requests: " << active_count << llendl;
}
}
示例4: llassert
// MAIN thread
bool LLQueuedThread::waitForResult(LLQueuedThread::handle_t handle, bool auto_complete)
{
llassert (handle != nullHandle());
bool res = false;
bool waspaused = isPaused();
bool done = false;
while(!done)
{
update(0); // unpauses
lockData();
QueuedRequest* req = (QueuedRequest*)mRequestHash.find(handle);
if (!req)
{
done = true; // request does not exist
}
else if (req->getStatus() == STATUS_COMPLETE && !(req->getFlags() & FLAG_LOCKED))
{
res = true;
if (auto_complete)
{
mRequestHash.erase(handle);
req->deleteRequest();
// check();
}
done = true;
}
unlockData();
if (!done && mThreaded)
{
yield();
}
}
if (waspaused)
{
pause();
}
return res;
}
示例5: switch
void TIDorb::core::poa::RequestQueue::discardAll()
{
// TIDThr::Synchronized synchro(*this); // Always called from a syncronized block
QueuedRequest* req;
switch (_comparator_type){
case PRIORITY_REQUEST_COMPARATOR:
while (!_priority_value->empty()){
req = _priority_value->top();
req->setMustDiscard(true);
_priority_value->pop();
}
break;
case DEADLINE_REQUEST_COMPARATOR:
while (!_deadline_value->empty()){
req = _deadline_value->top();
req->setMustDiscard(true);
_deadline_value->pop();
}
break;
case TEMPORAL_REQUEST_COMPARATOR:
while (!_temporal_value->empty()){
req = _temporal_value->top();
req->setMustDiscard(true);
_temporal_value->pop();
}
break;
default:
while (!_value->empty()){
req = _value->front();
req->setMustDiscard(true);
_value->pop_front();
}
break;
}
};