本文整理汇总了C++中IEvent::ToFill方法的典型用法代码示例。如果您正苦于以下问题:C++ IEvent::ToFill方法的具体用法?C++ IEvent::ToFill怎么用?C++ IEvent::ToFill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEvent
的用法示例。
在下文中一共展示了IEvent::ToFill方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WaitForGeneric
IEventSPtr OMXComponent::WaitForGeneric(const list<IEventSPtr> &lstEvents, unsigned int uTimeoutMs)
{
IEventSPtr pRes;
uint32_t u32Sec;
uint32_t u32NanoSec;
m_pClock->GetCurrent(&u32Sec, &u32NanoSec);
add_milliseconds(&u32Sec, &u32NanoSec, uTimeoutMs);
bool bMatch = false;
bool bFailure = false;
// go until we either fail or succeed
while ((!bFailure) && (!bMatch))
{
// go through all things we _can_ match with ...
for (list<IEventSPtr>::const_iterator lsi = lstEvents.begin(); lsi != lstEvents.end(); lsi++)
{
// determine what type of event this is
IEvent *pEvent = lsi->get();
OMXEventData *pOMX = pEvent->ToEvent();
EmptyBufferDoneData *pEmpty = pEvent->ToEmpty();
FillBufferDoneData *pFill = pEvent->ToFill();
Lock();
if (pEmpty != NULL)
{
for (list<EmptyBufferDoneData>::iterator li = m_lstEmpty.begin(); li != m_lstEmpty.end(); li++)
{
if (li->pBuffer == pEmpty->pBuffer)
{
bMatch = true;
m_lstEmpty.erase(li);
pRes = *lsi;
break;
}
}
}
// if we are waiting for an OMXEvent
else if (pOMX != NULL)
{
for (list<OMXEventData>::iterator li = m_lstEvents.begin(); li != m_lstEvents.end(); li++)
{
// if we found the match
if ((li->eEvent == pOMX->eEvent) && (pOMX->nData1 == li->nData1) && (pOMX->nData2 == li->nData2))
{
bMatch = true;
m_lstEvents.erase(li); // remove this item from the list because the caller knows about it now
pRes = *lsi;
break; // must break here to about segfault since we just called erase()
}
}
}
else if (pFill != NULL)
{
for (list<FillBufferDoneData>::iterator li = m_lstFill.begin(); li != m_lstFill.end(); li++)
{
if (li->pBuffer == pFill->pBuffer)
{
bMatch = true;
m_lstFill.erase(li);
pRes = *lsi;
break;
}
}
}
// else this should never happen
else
{
assert(false);
}
Unlock();
// if we found a match, we're done
if (bMatch)
{
break;
}
} // end for
// if we didn't get a match we need to wait for success or a timeout
if (!bMatch)
{
Lock();
// If we got an error or timed out, then we're done
// (this implicitly unlocks the mutex during the waiting period, then relocks it upon returning!)
if (!m_pLocker->WaitForEvent(u32Sec, u32NanoSec))
{
bFailure = true;
}
Unlock();
}
} // end while we haven't succeeded or failed
//.........这里部分代码省略.........