-
-
Save Constellation/e27d023de983af2cee917200b10c34e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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