Boost logo

Boost :

Subject: Re: [boost] [thread] Obtaining thread id on Windows
From: Yechezkel Mett (ymett.on.boost_at_[hidden])
Date: 2009-09-10 06:35:52

2009/9/10 Agustín K-ballo Bergé <kaballo86_at_[hidden]>:
> I've found a need to retrieve a thread id rather than a thread handle on
> Windows. There is no documented way to get it from the handle on XP (see
> ). Would it make sense to add a get_native_id member function?

boost::thread and std::thread don't know what the native thread type
is, nor do they know that Windows has two native thread types. The
correct solution seems to be:

struct native_handle_type
  HANDLE handle;
  DWORD id;

  // perhaps, for backward compatibilty
  operator HANDLE() { return handle; }

In other words it's a QOI detail.

Yechezkel Mett

Boost list run by bdawes at, gregod at, cpdaniel at, john at