获取当前线程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;
} |