Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] getting thread id number
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-05-27 18:52:58


----- Original Message -----
From: "Hipatia" <hipatia_370_at_[hidden]>
To: <boost-users_at_[hidden]>
Sent: Friday, April 24, 2009 8:47 PM
Subject: [Boost-users] [thread] getting thread id number

>
>
> Hi!
>
> I'm trying to get the id number of a thread just to write it to the standard
> output.
>
> Since I'm not an expert in c++ programming, let me explain what I do (even
> if it's quite simple): a create an instance as follows,
> boost::thread::id thread_id= boost::this_thread::get_id();
> By debugging my code with Visual Studio, I see that 'thread_id' has an
> 'unsigned int' object member called 'id', so I would like to display this
> value.
> Unfortunately, I cannot find in the boost documentation any function member
> of boost::thread::id class that returns its value.

Hi,

have you tried with the native_hadle() function. One major caveat: you can not revover directly the current boost::thread using the interface provided by the library,incroyable, isn't it? So you will need to maintain a map from boost::thread::id to boost::thread* or native_handle_type

HTH,
Vicente


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