MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

valdi/test/runtime/Threading_tests.cpp:19–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17namespace ValdiTest {
18
19TEST(ThreadedDispatchQueue, startsThreadOnFirstTaskEnqueued) {
20 auto dispatchQueue = makeShared<ThreadedDispatchQueue>(STRING_LITERAL("Test Queue"), ThreadQoSClassNormal);
21
22 ASSERT_FALSE(dispatchQueue->hasThreadRunning());
23
24 bool didRun = false;
25 dispatchQueue->sync([&]() { didRun = true; });
26
27 ASSERT_TRUE(didRun);
28 // Sync calls should not trigger the thread creation
29 ASSERT_FALSE(dispatchQueue->hasThreadRunning());
30
31 dispatchQueue->async([]() {});
32
33 ASSERT_TRUE(dispatchQueue->hasThreadRunning());
34}
35
36struct TestDtor {
37 DispatchFunction cb;

Callers

nothing calls this directly

Calls 13

hasThreadRunningMethod · 0.80
barrierMethod · 0.80
ownsMethod · 0.80
cancelMethod · 0.65
valueMethod · 0.65
nowFunction · 0.50
createFunction · 0.50
syncMethod · 0.45
asyncMethod · 0.45
enqueueMethod · 0.45
runNextTaskMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected