|
@@ -30,7 +30,7 @@ FIXTURE(ThreadPool)
|
|
public:
|
|
public:
|
|
// Represents a single unit of work. In this test we just set an element in
|
|
// Represents a single unit of work. In this test we just set an element in
|
|
// a result vector.
|
|
// a result vector.
|
|
- struct TestItem : public ThreadPool::WorkItem
|
|
|
|
|
|
+ struct TestItem : public TorqueThreadPool::WorkItem
|
|
{
|
|
{
|
|
U32 mIndex;
|
|
U32 mIndex;
|
|
Vector<U32>& mResults;
|
|
Vector<U32>& mResults;
|
|
@@ -46,7 +46,7 @@ public:
|
|
|
|
|
|
// A worker that delays for some time. We'll use this to test the ThreadPool's
|
|
// A worker that delays for some time. We'll use this to test the ThreadPool's
|
|
// synchronous and asynchronous operations.
|
|
// synchronous and asynchronous operations.
|
|
- struct DelayItem : public ThreadPool::WorkItem
|
|
|
|
|
|
+ struct DelayItem : public TorqueThreadPool::WorkItem
|
|
{
|
|
{
|
|
U32 ms;
|
|
U32 ms;
|
|
DelayItem(U32 _ms) : ms(_ms) {}
|
|
DelayItem(U32 _ms) : ms(_ms) {}
|
|
@@ -69,7 +69,7 @@ TEST_FIX(ThreadPool, BasicAPI)
|
|
results[i] = U32(-1);
|
|
results[i] = U32(-1);
|
|
|
|
|
|
// Launch the work items.
|
|
// Launch the work items.
|
|
- ThreadPool* pool = &ThreadPool::GLOBAL();
|
|
|
|
|
|
+ TorqueThreadPool* pool = &TorqueThreadPool::GLOBAL();
|
|
for (U32 i = 0; i < numItems; i++)
|
|
for (U32 i = 0; i < numItems; i++)
|
|
{
|
|
{
|
|
ThreadSafeRef<TestItem> item(new TestItem(i, results));
|
|
ThreadSafeRef<TestItem> item(new TestItem(i, results));
|
|
@@ -89,7 +89,7 @@ TEST_FIX(ThreadPool, Asynchronous)
|
|
const U32 delay = 500; //ms
|
|
const U32 delay = 500; //ms
|
|
|
|
|
|
// Launch a single delaying work item.
|
|
// Launch a single delaying work item.
|
|
- ThreadPool* pool = &ThreadPool::GLOBAL();
|
|
|
|
|
|
+ TorqueThreadPool* pool = &TorqueThreadPool::GLOBAL();
|
|
ThreadSafeRef<DelayItem> item(new DelayItem(delay));
|
|
ThreadSafeRef<DelayItem> item(new DelayItem(delay));
|
|
pool->queueWorkItem(item);
|
|
pool->queueWorkItem(item);
|
|
|
|
|
|
@@ -107,7 +107,7 @@ TEST_FIX(ThreadPool, Synchronous)
|
|
const U32 delay = 500; //ms
|
|
const U32 delay = 500; //ms
|
|
|
|
|
|
// Launch a single delaying work item.
|
|
// Launch a single delaying work item.
|
|
- ThreadPool* pool = &ThreadPool::GLOBAL();
|
|
|
|
|
|
+ TorqueThreadPool* pool = &TorqueThreadPool::GLOBAL();
|
|
ThreadSafeRef<DelayItem> item(new DelayItem(delay));
|
|
ThreadSafeRef<DelayItem> item(new DelayItem(delay));
|
|
pool->queueWorkItem(item);
|
|
pool->queueWorkItem(item);
|
|
|
|
|