PTHREAD_MAIN_NP(3) Library Functions Manual PTHREAD_MAIN_NP(3)

pthread_main_np — identify the initial thread

POSIX Threads Library (libpthread, -lpthread)

#include <pthread.h>

int
pthread_main_np(void);

The () function identifies the initial (main) thread.

The pthread_main_np() function returns 1 if the calling thread is the main thread, 0 if not, and -1 if threading has not been initialized.

pthread(3), pthread_self(3)

The pthread_main_np() function is a non-standard extension.

April 26, 2026 NetBSD 11.99