Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost 1.42, gcc 4.4, ubuntu 10.10] Program hangs when using barrier.wait() even though all threads have reached wait.
From: Ignacio Burgueño (iburgueno_at_[hidden])
Date: 2011-06-23 15:53:41


>
> On Thu, Jun 23, 2011 at 10:32 AM, Gareth <gareth.tpc_at_[hidden]> wrote:
>
> ...

> >
> > I've also checked the bugs list for any known bugs, fixed or
> > otherwise, to do with threading and I haven't found anything. I'm not
> > sure what I'm doing wrong.
>

The problem is here:
https://gist.github.com/1041351#L60

You declare _barrier first and numCPU second, so in your constructor,
_barrier will be initialized first, using the value of numCPU, which hasn't
been initialized yet.
Just change the order of the declarations. Declare _barrier below numNPU.

By the way, compiling with -Wall catches all these errors.

Regards,
Ignacio Burgueño



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