Created
February 24, 2016 06:40
-
-
Save ityuhui/99c0229b3ffd2c8dde23 to your computer and use it in GitHub Desktop.
C++11 多线程
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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