C++11标准库支持了thread,在MAC上试一试:
#include <iostream>
#include <thread>
void hello(void)
{
std::cout << "Hello concurrent world" << std::endl;
}
int main(void)
{
std::thread t(hello);
t.join();
}
命令行编译(如果用xcode编译和其它oc工程一样简单):
clang++ thread.cpp -o thread -std=c++11执行:
Hello concurrent world
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/yamingwu/article/details/47057249