Skip to content

Instantly share code, notes, and snippets.

@Constellation

Constellation/t.cc Secret

Created Apr 14, 2016
Embed
What would you like to do?
TEST(WTF_RunLoop, ManyTimes)
{
RunLoop::initializeMainRunLoop();
class Counter {
public:
void run()
{
if (++m_count == 100000000) {
RunLoop::current().stop();
return;
}
RunLoop::current().dispatch([this] {
run();
});
}
private:
unsigned m_count { 0 };
};
Counter counter;
RunLoop::current().dispatch([&counter] {
counter.run();
});
RunLoop::run();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.