Board logo

标题: 获取当前线程ID [打印本页]

作者: yuyang911220    时间: 2017-1-25 20:19     标题: 获取当前线程ID

获取当前线程ID
#include
<iostream>
#include
<windows.h>
#include
<boost/thread.hpp>


void thread_fun()
{
    std::cout << boost::this_thread::get_id()
<<
"\n";
    std::cout << std::hex <<
GetCurrentThreadId()<<"\n";
    std::cout <<
GetCurrentThread()
<<
"\n";
    std::cin.get();
}
int main()
{

    std::cout << boost::this_thread::get_id()
<<
"\n";
    std::cout << std::hex <<
GetCurrentThreadId()<<"\n";
    std::cout <<
GetCurrentThread()
<<
"\n\n";
    std::cin.get();
    boost::thread t( thread_fun );
    t.join();

return
0;
}




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0