Updated: April 19, 2023 |
Get the thread ID
#include <process.h> int gettid( void );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The gettid() function gets the thread ID for the calling thread.
The thread ID.
#include <stdio.h> #include <stdlib.h> #include <process.h> int main ( void ) { printf( "I'm thread %d\n", gettid() ); return EXIT_SUCCESS; }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |