gettid()

Updated: April 19, 2023

Get the thread ID

Synopsis:

#include <process.h>

int gettid( void );

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The gettid() function gets the thread ID for the calling thread.

Returns:

The thread ID.

Examples:

#include <stdio.h>
#include <stdlib.h>
#include <process.h>

int main ( void )
{
    printf( "I'm thread %d\n", gettid() );
    return EXIT_SUCCESS;
}

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes