本文整理汇总了C++中EventSP::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ EventSP::reset方法的具体用法?C++ EventSP::reset怎么用?C++ EventSP::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventSP
的用法示例。
在下文中一共展示了EventSP::reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindNextEventInternal
bool Listener::FindNextEventInternal(
std::unique_lock<std::mutex> &lock,
Broadcaster *broadcaster, // nullptr for any broadcaster
const ConstString *broadcaster_names, // nullptr for any event
uint32_t num_broadcaster_names, uint32_t event_type_mask, EventSP &event_sp,
bool remove) {
// NOTE: callers of this function must lock m_events_mutex using a
// Mutex::Locker
// and pass the locker as the first argument. m_events_mutex is no longer
// recursive.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
if (m_events.empty())
return false;
Listener::event_collection::iterator pos = m_events.end();
if (broadcaster == nullptr && broadcaster_names == nullptr &&
event_type_mask == 0) {
pos = m_events.begin();
} else {
pos = std::find_if(m_events.begin(), m_events.end(),
EventMatcher(broadcaster, broadcaster_names,
num_broadcaster_names, event_type_mask));
}
if (pos != m_events.end()) {
event_sp = *pos;
if (log != nullptr)
log->Printf("%p '%s' Listener::FindNextEventInternal(broadcaster=%p, "
"broadcaster_names=%p[%u], event_type_mask=0x%8.8x, "
"remove=%i) event %p",
static_cast<void *>(this), GetName(),
static_cast<void *>(broadcaster),
static_cast<const void *>(broadcaster_names),
num_broadcaster_names, event_type_mask, remove,
static_cast<void *>(event_sp.get()));
if (remove) {
m_events.erase(pos);
// Unlock the event queue here. We've removed this event and are about to
// return
// it so it should be okay to get the next event off the queue here - and
// it might
// be useful to do that in the "DoOnRemoval".
lock.unlock();
event_sp->DoOnRemoval();
}
return true;
}
event_sp.reset();
return false;
}
示例2: lock
bool
Listener::FindNextEventInternal
(
Broadcaster *broadcaster, // NULL for any broadcaster
const ConstString *broadcaster_names, // NULL for any event
uint32_t num_broadcaster_names,
uint32_t event_type_mask,
EventSP &event_sp,
bool remove)
{
//LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
Mutex::Locker lock(m_events_mutex);
if (m_events.empty())
return false;
Listener::event_collection::iterator pos = m_events.end();
if (broadcaster == NULL && broadcaster_names == NULL && event_type_mask == 0)
{
pos = m_events.begin();
}
else
{
pos = std::find_if (m_events.begin(), m_events.end(), EventMatcher (broadcaster, broadcaster_names, num_broadcaster_names, event_type_mask));
}
if (pos != m_events.end())
{
event_sp = *pos;
if (remove)
{
m_events.erase(pos);
if (m_events.empty())
m_cond_wait.SetValue (false, eBroadcastNever);
}
// Unlock the event queue here. We've removed this event and are about to return
// it so it should be okay to get the next event off the queue here - and it might
// be useful to do that in the "DoOnRemoval".
lock.Unlock();
// Don't call DoOnRemoval if you aren't removing the event...
if (remove)
event_sp->DoOnRemoval();
return true;
}
event_sp.reset();
return false;
}