用C/C++创建多线程应用程序最简单的方法是什么?
发布于 2009-10-02 18:43:14
C++0x规范包括线程工具(我最喜欢的新特性之一)。很快你编译的操作系统就不再重要了!只要看看创建一个新线程并加入到创建者线程中是多么容易:
#include <thread>
#include <iostream>
class SayHello
{
public:
    void operator()() const
    {
        std::cout<<"hello"<<std::endl;
    }
};
int main()
{
    std::thread t((SayHello()));
    t.join();
}Visual Studio2010正在实现C++0x的一部分,但我们还在等待线程工具。
https://stackoverflow.com/questions/1511101
复制相似问题