本文整理汇总了C++中common::Event::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ Event::Set方法的具体用法?C++ Event::Set怎么用?C++ Event::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Event
的用法示例。
在下文中一共展示了Event::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Video_ExitLoop
void VideoBackendHardware::Video_ExitLoop()
{
ExitGpuLoop();
s_FifoShuttingDown.Set();
s_efbAccessReadyEvent.Set();
s_perfQueryReadyEvent.Set();
}
示例2: DSP_StopSoundStream
void DSPLLE::DSP_StopSoundStream()
{
if (m_bDSPThread)
{
m_bIsRunning.Clear();
ppcEvent.Set();
dspEvent.Set();
m_hDSPThread.join();
}
}
示例3: DSP_StopSoundStream
void DSPLLE::DSP_StopSoundStream()
{
DSPInterpreter::Stop();
m_bIsRunning = false;
if (m_bDSPThread)
{
ppcEvent.Set();
dspEvent.Set();
m_hDSPThread.join();
}
}
示例4: DVDThread
static void DVDThread()
{
Common::SetCurrentThreadName("DVD thread");
while (true)
{
s_request_queue_expanded.Wait();
if (s_dvd_thread_exiting.IsSet())
return;
ReadRequest request;
while (s_request_queue.Pop(request))
{
FileMonitor::Log(*s_disc, request.partition, request.dvd_offset);
std::vector<u8> buffer(request.length);
if (!s_disc->Read(request.dvd_offset, request.length, buffer.data(), request.partition))
buffer.resize(0);
request.realtime_done_us = Common::Timer::GetTimeUs();
s_result_queue.Push(ReadResult(std::move(request), std::move(buffer)));
s_result_queue_expanded.Set();
if (s_dvd_thread_exiting.IsSet())
return;
}
}
}
示例5: StartReadInternal
static void StartReadInternal(bool copy_to_ram, u32 output_address, u64 dvd_offset, u32 length,
const DiscIO::Partition& partition,
DVDInterface::ReplyType reply_type, s64 ticks_until_completion)
{
ASSERT(Core::IsCPUThread());
ReadRequest request;
request.copy_to_ram = copy_to_ram;
request.output_address = output_address;
request.dvd_offset = dvd_offset;
request.length = length;
request.partition = partition;
request.reply_type = reply_type;
u64 id = s_next_id++;
request.id = id;
request.time_started_ticks = CoreTiming::GetTicks();
request.realtime_started_us = Common::Timer::GetTimeUs();
s_request_queue.Push(std::move(request));
s_request_queue_expanded.Set();
CoreTiming::ScheduleEvent(ticks_until_completion, s_finish_read, id);
}
示例6: loop_thread
TEST(BusyLoopTest, MultiThreaded)
{
Common::BlockingLoop loop;
Common::Event e;
for (int i = 0; i < 100; i++)
{
loop.Prepare();
std::thread loop_thread([&]() { loop.Run([&]() { e.Set(); }); });
// Ping - Pong
for (int j = 0; j < 10; j++)
{
loop.Wakeup();
e.Wait();
// Just waste some time. So the main loop did fall back to the sleep state much more likely.
Common::SleepCurrentThread(1);
}
for (int j = 0; j < 100; j++)
{
// We normally have to call Wakeup to assure the Event is triggered.
// But this check is for an internal feature of the BlockingLoop.
// It's implemented to fall back to a busy loop regulary.
// If we're in the busy loop, the payload (and so the Event) is called all the time.
// loop.Wakeup();
e.Wait();
}
loop.Stop();
loop_thread.join();
}
}
示例7: DSPThread
// Regular thread
void DSPLLE::DSPThread(DSPLLE* dsp_lle)
{
Common::SetCurrentThreadName("DSP thread");
while (dsp_lle->m_bIsRunning.IsSet())
{
const int cycles = static_cast<int>(dsp_lle->m_cycle_count.load());
if (cycles > 0)
{
std::lock_guard<std::mutex> dsp_thread_lock(dsp_lle->m_csDSPThreadActive);
if (g_dsp_jit)
{
DSPCore_RunCycles(cycles);
}
else
{
DSPInterpreter::RunCyclesThread(cycles);
}
dsp_lle->m_cycle_count.store(0);
}
else
{
ppcEvent.Set();
dspEvent.Wait();
}
}
}
示例8: dsp_thread
// Regular thread
void DSPLLE::dsp_thread(DSPLLE *dsp_lle)
{
Common::SetCurrentThreadName("DSP thread");
while (dsp_lle->m_bIsRunning)
{
int cycles = (int)dsp_lle->m_cycle_count;
if (cycles > 0)
{
std::lock_guard<std::mutex> lk(dsp_lle->m_csDSPThreadActive);
if (dspjit)
{
DSPCore_RunCycles(cycles);
}
else
{
DSPInterpreter::RunCyclesThread(cycles);
}
Common::AtomicStore(dsp_lle->m_cycle_count, 0);
}
else
{
ppcEvent.Set();
dspEvent.Wait();
}
}
}
示例9: Host_Message
void Host_Message(int Id)
{
if (Id == WM_USER_STOP)
{
s_running.Clear();
updateMainFrameEvent.Set();
}
}
示例10: DSPCore_SetState
void DSPCore_SetState(DSPCoreState new_state)
{
core_state = new_state;
// kick the event, in case we are waiting
if (new_state == DSPCORE_RUNNING)
step_event.Set();
// Sleep(10);
DSPHost::UpdateDebugger();
}
示例11: VideoFifo_CheckPerfQueryRequest
static void VideoFifo_CheckPerfQueryRequest()
{
if (s_perfQueryRequested.IsSet())
{
g_perf_query->FlushResults();
s_perfQueryRequested.Clear();
s_perfQueryReadyEvent.Set();
}
}
示例12: VideoFifo_CheckEFBAccess
void VideoFifo_CheckEFBAccess()
{
if (s_efbAccessRequested.IsSet())
{
s_AccessEFBResult = g_renderer->AccessEFB(s_accessEFBArgs.type, s_accessEFBArgs.x, s_accessEFBArgs.y, s_accessEFBArgs.Data);
s_efbAccessRequested.Clear();
s_efbAccessReadyEvent.Set();
}
}
示例13: DSPCore_SetState
void DSPCore_SetState(State new_state)
{
core_state = new_state;
// kick the event, in case we are waiting
if (new_state == State::Running)
step_event.Set();
Host::UpdateDebugger();
}
示例14: StopDVDThread
static void StopDVDThread()
{
ASSERT(s_dvd_thread.joinable());
// By setting s_DVD_thread_exiting, we ask the DVD thread to cleanly exit.
// In case the request queue is empty, we need to set s_request_queue_expanded
// so that the DVD thread will wake up and check s_DVD_thread_exiting.
s_dvd_thread_exiting.Set();
s_request_queue_expanded.Set();
s_dvd_thread.join();
}
示例15: DSP_Update
void DSPLLE::DSP_Update(int cycles)
{
int dsp_cycles = cycles / 6;
if (dsp_cycles <= 0)
return;
// Sound stream update job has been handled by AudioDMA routine, which is more efficient
/*
// This gets called VERY OFTEN. The soundstream update might be expensive so only do it 200 times per second or something.
int cycles_between_ss_update;
if (g_dspInitialize.bWii)
cycles_between_ss_update = 121500000 / 200;
else
cycles_between_ss_update = 81000000 / 200;
m_cycle_count += cycles;
if (m_cycle_count > cycles_between_ss_update)
{
while (m_cycle_count > cycles_between_ss_update)
m_cycle_count -= cycles_between_ss_update;
soundStream->Update();
}
*/
if (m_bDSPThread)
{
if (requestDisableThread || NetPlay::IsNetPlayRunning() || Movie::IsMovieActive() || Core::g_want_determinism)
{
DSP_StopSoundStream();
m_bDSPThread = false;
requestDisableThread = false;
SConfig::GetInstance().bDSPThread = false;
}
}
// If we're not on a thread, run cycles here.
if (!m_bDSPThread)
{
// ~1/6th as many cycles as the period PPC-side.
DSPCore_RunCycles(dsp_cycles);
}
else
{
// Wait for DSP thread to complete its cycle. Note: this logic should be thought through.
ppcEvent.Wait();
m_cycle_count.fetch_add(dsp_cycles);
dspEvent.Set();
}
}