Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] getting thread id number
From: Igor R (boost.lists_at_[hidden])
Date: 2009-04-25 17:18:00


>               |-> id
> This last parameter (an unsigned integer) is the one that I want to
> retrieve.
>
> By the way, in Visual Studio there is a thread watch window in which I can
> see the current existing threads and their associated ID numbers. Thus, both
> the id shown in this window and the one shown in the thread::id properties
> are the same.

This is implementation detail that boost.thread doesn't expose. But as
already proposed, you can make std::map<thread::id, int> that maps
thread_id objects to windows-specific thread-id, like this:

std::map<thread::id, DWORD> ids;
ids[myThread.get_id()] = GetThreadID(myThread.native_handle());


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net