ubuntu10.04にclang+llvm 3.0をコンパイルしてインストールし、svnからlibc++もインストールしました。libc ++のステータスはスレッドのサポートが完了したことを示しているので、std::asyncを試してみたかったのです。だから私はアンソニーウィリアムズによって与えられた例に従います
そして、それをコンパイルするために小さな変更を加えるだけです:
#include <future>
#include <iostream>
int calculate_the_answer_to_LtUaE()
{
return 42;
}
void do_stuff()
{
std::cout << "doing stuff" << std::endl;
}
int main()
{
std::future<int> the_answer=std::async(calculate_the_answer_to_LtUaE);
do_stuff();
std::cout<<"The answer to life, the universe and everything is "
<<the_answer.get()<<std::endl;
}
そして私は
clang ++ --std = c ++ 0x -stdlib = libc ++ -lpthread async.cpp
ただし、実行され、常にコアダンプで終了します。
人生、宇宙、そしてすべてへの答えは中止されます(コアダンプ)
コアダンプを確認すると、このようなスタックが表示されます(ヒントはわかりません)
#0 0x00007fd0a1a7ba75 in raise()from /lib/libc.so.6 #1 0x00007fd0a1a7f5c0 in abort()from /lib/libc.so.6 #2 0x00007fd0a22a735b in std :: exception_ptr ::〜exception_ptr(this =)at ../src/exception.cpp:130 #3 0x0000000000404178 in void std :: __ 1 :: __assoc_state :: set_value(int &&)() #4 0x00000000004051ae in _ZNSt3__119__async_assoc_stateIiNS_12__async_funcIPFivEJEEEE9__executeEv() #5 0x0000000000404e00 in _ZNSt3__114__thread_proxyINS_5tupleIJMNS_19__async_assoc_stateIiNS_12__async_funcIPFivEJEEEEEFvvEPS7_EEEEEPvSC_() #6 /lib/libpthread.so.0からのstart_thread()の0x00007fd0a250f9ca #7 0x00007fd0a1b2e70d in clone()from /lib/libc.so.6 #8 0x0000000000000000 in ?? ()
誰もが理由を知っていますか?