Boost logo

Boost :

From: bill_kempf (williamkempf_at_[hidden])
Date: 2002-01-24 13:39:13


--- In boost_at_y..., "dp11229" <dpodbori_at_l...> wrote:
> Hi,
>
> I just wanted to point out to what looks like a bug in
> <http://www.boost.org/libs/thread/doc/thread.html#Example>
>
> In the code
>
> int main()
> {
> int secs = 5;
> boost::thread thrd(thread_alarm( secs ));
> thrd.join();
> }
>
> The line
> boost::thread thrd(thread_alarm( secs ));
>
> looks like a function declaration to the compiler, as if it was
> written
>
> boost::thread thrd( thread_alarm secs );
>
> and not an object construction. Correspondingly, the compiler
issues
> a counter-intuitive message similar to (on GCC)
> "Cannot call a method 'join' on thrd which is of non-agregate type
> boost::thread ()(alarm)"
>
> A simple way to fix it is to remove the ambiguity by declaring
alarm
> as a named object, i.e.
>
> int main()
> {
> int secs = 5;
> thread_alarm alrm( secs );
> boost::thread thrd( alrm );
> thrd.join();
> }

Ooops. This was pointed out some time ago and I thought I'd
corrected it, but I must have failed to commit to CVS. I'll correct
this ASAP.

Thanks,

Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk