Skip to content

Instantly share code, notes, and snippets.

@ityuhui
Created February 24, 2016 06:40
Show Gist options
  • Save ityuhui/99c0229b3ffd2c8dde23 to your computer and use it in GitHub Desktop.
Save ityuhui/99c0229b3ffd2c8dde23 to your computer and use it in GitHub Desktop.
C++11 多线程
#include <thread>
#include <iostream>
void thread1_task()
{
std::cout << "thread1" << std::endl;
}
void thread2_task()
{
std::cout << "thread2" << std::endl;
}
int main()
{
std::thread t1(thread1_task);
std::thread t2(thread2_task);
t1.join();
t2.join();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment