C++线程操作

来源:互联网 发布:it团队建设 编辑:程序博客网 时间:2024/05/17 18:23

1.C++线程创建及MFC下防窗口死机(Win)

HANDLE m_hThread = CreateThread(NULL, 0, ClipThread, this, 0, NULL);MSG msg;DWORD ExitCode = 0;while (GetExitCodeThread(m_hThread, &ExitCode) && STILL_ACTIVE==ExitCode){if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {TranslateMessage (&msg) ;DispatchMessage(&msg);}}CloseHandle(m_hThread);m_hThread = NULL;
2.C++线程创建(Linux)

    pthread_t motoThread;    pthread_create(&motoThread, NULL, MotoReadLoop, NULL);    pthread_join(motoThread, NULL);



0 0
原创粉丝点击