当前位置: 首页>>代码示例>>C++>>正文


C++ FifoQueue::Push方法代码示例

本文整理汇总了C++中common::FifoQueue::Push方法的典型用法代码示例。如果您正苦于以下问题:C++ FifoQueue::Push方法的具体用法?C++ FifoQueue::Push怎么用?C++ FifoQueue::Push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common::FifoQueue的用法示例。


在下文中一共展示了FifoQueue::Push方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ScheduleEvent_Threadsafe

// This is to be called when outside threads, such as the graphics thread, wants to
// schedule things to be executed on the main thread.
void ScheduleEvent_Threadsafe(int cyclesIntoFuture, int event_type, u64 userdata)
{
	std::lock_guard<std::mutex> lk(tsWriteLock);
	Event ne;
	ne.time = globalTimer + cyclesIntoFuture;
	ne.type = event_type;
	ne.userdata = userdata;
	tsQueue.Push(ne);
}
开发者ID:calmbrain,项目名称:dolphin,代码行数:11,代码来源:CoreTiming.cpp

示例2: ScheduleEvent_Threadsafe

// This is to be called when outside threads, such as the graphics thread, wants to
// schedule things to be executed on the main thread.
void ScheduleEvent_Threadsafe(s64 cyclesIntoFuture, int event_type, u64 userdata)
{
	_assert_msg_(POWERPC, !Core::IsCPUThread(), "ScheduleEvent_Threadsafe from wrong thread");
	if (Core::g_want_determinism)
	{
		ERROR_LOG(POWERPC, "Someone scheduled an off-thread \"%s\" event while netplay or movie play/record "
		                   "was active.  This is likely to cause a desync.",
		                   event_types[event_type].name.c_str());
	}
	std::lock_guard<std::mutex> lk(tsWriteLock);
	Event ne;
	ne.time = g_globalTimer + cyclesIntoFuture;
	ne.type = event_type;
	ne.userdata = userdata;
	tsQueue.Push(ne);
}
开发者ID:Teybeo,项目名称:dolphin,代码行数:18,代码来源:CoreTiming.cpp

示例3: ScheduleEvent

void ScheduleEvent(s64 cycles_into_future, EventType* event_type, u64 userdata, FromThread from)
{
    _assert_msg_(POWERPC, event_type, "Event type is nullptr, will crash now.");

    bool from_cpu_thread;
    if (from == FromThread::ANY)
    {
        from_cpu_thread = Core::IsCPUThread();
    }
    else
    {
        from_cpu_thread = from == FromThread::CPU;
        _assert_msg_(POWERPC, from_cpu_thread == Core::IsCPUThread(),
                     "ScheduleEvent from wrong thread (%s)", from_cpu_thread ? "CPU" : "non-CPU");
    }

    if (from_cpu_thread)
    {
        s64 timeout = GetTicks() + cycles_into_future;

        // If this event needs to be scheduled before the next advance(), force one early
        if (!s_is_global_timer_sane)
            ForceExceptionCheck(cycles_into_future);

        s_event_queue.emplace_back(Event{timeout, s_event_fifo_id++, userdata, event_type});
        std::push_heap(s_event_queue.begin(), s_event_queue.end(), std::greater<Event>());
    }
    else
    {
        if (Core::g_want_determinism)
        {
            ERROR_LOG(POWERPC, "Someone scheduled an off-thread \"%s\" event while netplay or "
                      "movie play/record was active.  This is likely to cause a desync.",
                      event_type->name->c_str());
        }

        std::lock_guard<std::mutex> lk(s_ts_write_lock);
        s_ts_queue.Push(Event{g_global_timer + cycles_into_future, 0, userdata, event_type});
    }
}
开发者ID:Sintendo,项目名称:dolphin,代码行数:40,代码来源:CoreTiming.cpp


注:本文中的common::FifoQueue::Push方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。