windows下
CreateThread() / _beginthreadex() 创建线程
ExitThread()或 TerminateThread()销毁线程
SuspendThread()暂停线程
ResumeThread()恢复线程
WaitForSingleObject()等待线程
linux下
pthread_create() 创建线程
pthread_exit() 或pthread_cancel() 销毁线程
pthread_join() 等待线程
boost 线程库可以跨平台
join()一直阻塞等待,直到当前线程结束
time_join() 线程结束时,最多等待多长时间后返回
thread::yield() 当前线程放弃余下的时间
this_thread::sleep(chrono::seconds(1)) 让线程睡眠
#include<boost/thread.hpp>