å§ãã« æ¬è¨äºã¯ C++11 Advent Calendar 2011 : ATND ã®6æ¥ç®ã§ãã std::thread C++11æ代ã®threadã®åºæ¬ã¯ std::thread ã§ããããããã« #include ããã¾ããããstd::threadã¯ã³ã³ã¹ãã©ã¯ã¿ã§æ¸¡ãããé¢æ°ãªãã¸ã§ã¯ããå¥ã¹ã¬ããã§å®è¡ãã¾ãã #include <iostream> #include <thread> void f() { std::cout << "f()" << std::endl; } int main() { std::thread thr(f); thr.join(); return 0; } ãã®ããã°ã©ã ãå®è¡ãã㨠f() ã¨è¡¨ç¤ºãããã¯ãã§ããã³ã³ãã¤ã«ãã¦å®è¡ãã¦ã¿ã¾ãã $ g++ -o thr thr.cpp -std=c++0x $ ./thr f() $ 確ãã«
{{#tags}}- {{label}}
{{/tags}}