Boost logo

Boost Users :

Subject: Re: [Boost-users] thread running many times
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2011-09-11 17:00:04


Am 11.09.2011 um 22:46 schrieb Igor R:

>> creating thread group
>> for(i=0; i < iterations; ++i) {
>> run threadgroup for parallel part, till all threads finished
>> run serial part
>> }
>>
>> So I would like to ask for, if the thread group is created, and I call the join_all within the loop, each "join_all" starts the full group again on each iteration or need I create a new threadgroup on each iteration (join_all can be called only once on a group)?
>
>
> join_all() waits (blocks) until the execution of all the threads in
> the group is complete - *that's all*.
> In other words: join_all(), like thread::join(), does not start
> anything. It just waits until thread completes.
> So at the end of every iteration you don't have threads anymore -- if
> you need them again, you have to create another ones.

Thanks, I understand, so my group is after join_all empty, so I change my code to:

for(i=0; i < iteration; ++i) {
      create thread group
      run thread group with join_all for parallel part
      run serial part
}

so on each iteration I need to create a new thread group

Thanks

Phil


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net