mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-15 23:01:39 +00:00
Reformat all the things. Have fun with merge conflicts.
This commit is contained in:
parent
2115e8a4a6
commit
3570c7f03a
1116 changed files with 187405 additions and 180344 deletions
|
@ -12,40 +12,34 @@
|
|||
|
||||
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();
|
||||
});
|
||||
});
|
||||
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();
|
||||
// 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);
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
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();
|
||||
}
|
||||
loop.Stop();
|
||||
loop_thread.join();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue