MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / TEST_FIX

Function TEST_FIX

Engine/source/platform/threads/test/threadPoolTest.cpp:63–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61};
62
63TEST_FIX(ThreadPool, BasicAPI)
64{
65 // Construct the vector of results from the work items.
66 const U32 numItems = 100;
67 Vector<U32> results(__FILE__, __LINE__);
68 results.setSize(numItems);
69 for (U32 i = 0; i < numItems; i++)
70 results[i] = U32(-1);
71
72 // Launch the work items.
73 ThreadPool* pool = &ThreadPool::GLOBAL();
74 for (U32 i = 0; i < numItems; i++)
75 {
76 ThreadSafeRef<TestItem> item(new TestItem(i, results));
77 pool->queueWorkItem(item);
78 }
79
80 pool->waitForAllItems();
81
82 // Verify.
83 for (U32 i = 0; i < numItems; i++)
84 EXPECT_EQ(results[i], i) << "result mismatch";
85 results.clear();
86}
87
88TEST_FIX(ThreadPool, Asynchronous)
89{

Callers

nothing calls this directly

Calls 6

queueWorkItemMethod · 0.80
waitForAllItemsMethod · 0.80
hasExecutedMethod · 0.80
U32Enum · 0.50
setSizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected