Tried to run some sample code.
But something unexpected occured.
I wonder is there any known issus about boost.thread used with libc++ together ?
Program compiled with -std=c++11
or no option runs well.
But when I compiled with -stdlib=libc++
or -std=c++11 -stdlib=libc++
The output was like:
in main
in thread
bash: line 1: 37501 Segmentation fault: 11 ./a.out
Compiler:
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix
OS: Mac OS X 10.8.3
The sample code is quite simple:
#include "stdio.h"
#include <boost/thread/thread.hpp>
class callable
{
public:
void operator()()
{
printf("in thread\n");
}
};
int main()
{
boost::thread t = boost::thread(callable());
printf("in main\n");
t.join();
return 0;
}