|
Boost : |
From: dp11229 (dpodbori_at_[hidden])
Date: 2002-01-24 13:13:52
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();
}
Best regards,
Dmitry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk