12. července 2012 15:11
I use unbounded buffer like this in VS10:
bool accepted = asend(this->workQueue, work); //returns true
On a Ms server 2003 R2 SP2 in debug view every time I add a message to the workQueue I see the unprocessed messages growing for the unbounded buffer. Can I use PPL on that platform ? I have to mention that my implementation works on later platforms, and don't know the reason I could get this issues (asend returns true)
Thanks for your help !
PS: the way I observed the issue was because I was adding messages to the buffer and from another agent(thread) I was consuming messages but dequeue() method does not return the new work added.
- Upravený raiderG 12. července 2012 15:14
12. července 2012 15:27
Just wanted to add how I do the dequeueing from a ppl agent (dequeue gets stuck in this case even if I added elements as described in previous post)
auto value = this->workQueue.dequeue()
EDIT: I just discovered that in some cases debug view helper for unbounded_buffer shows that I also have messages (not unprocessed messages) but I am still not able to get them...
- Upravený raiderG 12. července 2012 15:29
13. července 2012 10:28
I've found out the conditions in which this bug reproduces. I've done my tests on on vmWare machine with has allocated only 1 core.
As soon as I've increased my number of cores to 3 things described didn't happen anymore. A little context about my application. I use ppl task_group and agents. I only use about 3 agents though. I guess this isn't supposed to happen. I also tried using 2 cores and reproduced the bug until I increased to 3 cores.
16. července 2012 15:24
I've found out how to fix the limitation/bug in ppl/agents as described above. If I set at application startup a default scheduler with min concurrency 3 or 4 things work as expected (this basically fixed problems that arise when my virtual machine has assigned less than 3 cores). Here is the code
// there is a bug using agents/ppl with some virtual machines at least, where if concurrency is too low // (machine has less than 3 cores for example) agents/ppl don't work as expected Concurrency::SchedulerPolicy minConcurrencyPolicy(1, Concurrency::MinConcurrency, 4); Concurrency::Scheduler::SetDefaultSchedulerPolicy(minConcurrencyPolicy);
- Označen jako odpověď raiderG 16. července 2012 15:25