void foo()
{
auto native = std::this_thread::get_id().native_handle();
// auto_native = std::this_thread::native_handle();
}
I would like for certain cross-platform tasks to be made easier.On posix systems, you can call pthread_self(); and widows GetCurrentThread(); to return the native_handle. but I would think something like this should be provided by the standard.Heres the stackoverflow post that pointed me here, http://stackoverflow.com/questions/16259257/c11-native-handle-is-not-a-member-of-stdthis-thread
On 4/28/13, Nicol Bolas <jmck...@gmail.com> wrote:
> On Sunday, April 28, 2013 3:54:50 PM UTC-7, Nicholas Pezolano wrote:
> > I would like for certain cross-platform tasks to be made easier.
> >
> > On posix systems, you can call pthread_self(); and widows
> > GetCurrentThread(); to return the native_handle. but I would
> > think something like this should be provided by the standard.
>
> He's asking what it is you want to *do *with that native thread
> handle. What are you trying to accomplish that you *need* the
> handle for the current thread?
If you are writing system-specific code, you can use an OS function
to get the thread handle. So, how much code you would write that
needs a native_handle function that also is not system-specific?
If it is not common, do we really need to standardize the mechanism
used to get the handle?