
On Sat, Aug 13, 2011 at 9:53 AM, Greg Rubino <bibil.thaysose@gmail.com> wrote:
2011/8/13 Юрій Зубрицький <mt.wizard@gmail.com>:
What do I see is that you hold const reference to ptime in random_activity_planner, but pass it by value to ctor. This isn't correct, as const reference prolongs life of ctor parameter only until ctor body end. Try changing either of these places (hold by value or pass by cref). Looks like when you don't threads stack place where copied ptime lived isn't reused, but with threads it is rewritten.
Aha, my mistake! Thanks for pointing that out! I think I'd rather pass by ref, I will try it soon.
Yep, that worked... How embarrassing... Thanks again!
Thanks again,
Greg
2011/8/13 Greg Rubino <bibil.thaysose@gmail.com>
On Fri, Aug 12, 2011 at 3:15 PM, Christian Holmquist <c.holmquist@gmail.com> wrote:
Also, I am aware that I don't need to be using threads here, but I am, and I don't understand why it's not working.
Does the code do the right thing if you remove the threads and just call random_activity_planner(activities,origin)(); directly?
Hi Christian,
Thanks for the quick response! I tried that and it behaves as expected if I remove the uses of boost::thread_group. That is, the container grows to activity_count elements and they are all properly initialized with random elements.
Greg
- Christian _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost