MCPcopy Create free account
hub / github.com/InoriRus/Kyty / WaitForEvents

Method WaitForEvents

source/emulator/src/Kernel/EventQueue.cpp:90–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90int KernelEqueuePrivate::WaitForEvents(KernelEvent* ev, int num, uint32_t micros)
91{
92 Core::LockGuard lock(m_mutex);
93
94 EXIT_IF(num < 1);
95
96 uint32_t elapsed = 0;
97 Core::Timer t;
98 t.Start();
99
100 for (;;)
101 {
102 int ret = GetTriggeredEvents(ev, num);
103
104 if (ret > 0 || (elapsed >= micros && micros != 0))
105 {
106 return ret;
107 }
108
109 if (micros == 0)
110 {
111 m_cond_var.Wait(&m_mutex);
112 } else
113 {
114 m_cond_var.WaitFor(&m_mutex, micros - elapsed);
115 }
116
117 elapsed = static_cast<uint32_t>(t.GetTimeS() * 1000000.0);
118 }
119
120 return 0;
121}
122
123void KernelEqueuePrivate::AddEvent(const KernelEqueueEvent& event)
124{

Callers 1

Calls 4

WaitForMethod · 0.80
GetTimeSMethod · 0.80
StartMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected