I know of the non-intuitive process to set the name of a thread under Windows (see "How to set name to a Win32 Thread?"). Is there a way to get the name of the thread? I don't see any Windows API that lets me do this (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684847(v=vs.85).aspx).
The pthread_getname_np() function retrieves the name of the thread. The buffer specified by name must be at least 16 characters in length. The returned thread name will be null terminated in the output buffer. By default, each thread is unnamed.
If you have a thread identifier, you can get the thread handle by calling the OpenThread function. OpenThread enables you to specify the handle's access rights and whether it can be inherited. A thread can use the GetCurrentThread function to retrieve a pseudo handle to its own thread object.
The Win32 thread library is a kernel-level library available on Windows systems. The Java thread API allows thread creation and management directly in Java programs.
The Win32 threads are implemented in the kernel space of Windows OS. The multi-threaded applications can use the Win32 API library similar to Pthread library. We must include Windows. h header file while using win32 API.
Threads don't actually have names in Win32. The process via RaiseException
is just a "Secret Handshake" with the VS Debugger, who actually stores the TID => Name mapping. Windows itself has no notion of a thread "Name".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With