Boost logo

Boost Users :

Subject: [Boost-users] Get "Native" thread id - feature request
From: Ondrej Sluciak (ondrej.sluciak_at_[hidden])
Date: 2009-11-05 10:02:03


Hello, is there a way how to get the thread id that system assigns to
thread? I mean the id that is located in "thread_info->id". It would
quite nice if boost could return this value, because for example if I
want to set name of the thread on windows using function
SetThreadName(), I need exactly that id. In my application I would have
to add this "feature" directly to boost::thread.hpp, which is not very
nice solution.
I know that also GetThreadName(myThread->native_handle()) should work,
but if I do it like this I always get a Windows error "The procedure
entry point GetThreadId could not be located in the dynamic link library
KERNEL32.dll". And I also guess, that this new "feature" wouldn't
destroy the overall design of boost::thread architecture. To get the
"real" thread id is in my opinion in general a useful thing.


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