std::thread segfault

Timothy Brownawell tbrownaw@prjek.net
Fri Apr 17 11:45:00 GMT 2009


On Tue, 2009-04-14 at 14:24 -0700, Matthew Lai wrote:
> I'm using my 4.4.0 SVN checked out a few days ago, and I tried to use 
> C++0x's std::thread, but it kept segfaulting on me.

It did this to me too, some time with google turned up (besides this
message)
   http://gcc.gnu.org/ml/libstdc++/2009-02/txt00002.txt
which makes it looks like "-pthread" is needed. And giving that option
does indeed seem to make it work here.

> This is on 64-bit Linux, x86-64 (Ubuntu 8.10).
> 
> -------------------------------------------------
> #include <thread>
> 
> void t() {
> }
> 
> int main() {
>     std::thread t1(&t);
> 
>     t1.join();
> }
> -------------------------------------------------




More information about the Gcc-help mailing list