windows 下多线程
unsigned uiThread2ID; HANDLE handle = (HANDLE)_beginthreadex(NULL, 0, ThreadUploadFun, NULL, CREATE_SUSPENDED, &uiThread2ID); ResumeThread(handle); CloseHandle(handle);
unsigned int __stdcall ThreadUploadFun(PVOID pM) { char str[100]; int thread_id = GetCurrentThreadId(); sprintf_s(str, "线程ID号为 % 4d的子线程启动", thread_id);return 0; }
#include <sstream> stringstream str; int thread_id = GetCurrentThreadId(); str << "线程ID号为"<< thread_id<<"的子线程启动"; cout << str.str() << endl;
posted on 2017-07-28 14:33 zyz913614263 阅读(190) 评论(0) 编辑 收藏 举报