Attempted fix for pointer/integer confusion. The warning from GCC
was: "ThreadPool.cpp:123:46: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]." It appears that an integer from 0 to threadCount was passed as to a value ultimately assigned to (void *)((Private)p->arg). This commit moved the integer into an unfreed block of memory and passed a pointer to it, but perhaps the threadNumber doesn't really need to be passed at all?
This commit is contained in:
parent
47919914a9
commit
4c860bf84b
@ -120,7 +120,10 @@ ThreadPool::ThreadPool(uint workerCount/*=processorCount()*/, bool useThreadAffi
|
||||
StringBuilder name;
|
||||
name.format("worker %d", i);
|
||||
workers[i].setName(name.release()); // @Leak
|
||||
workers[i].start(workerFunc, (void *)i);
|
||||
// This code was just wrong. Is this what was intended?
|
||||
uint* p = new uint; // @Leak
|
||||
*p = i;
|
||||
workers[i].start(workerFunc, (void *)p);
|
||||
}
|
||||
|
||||
allIdle = true;
|
||||
|
Loading…
Reference in New Issue
Block a user