Prerequisite : Multithreading in C
Syntax :- pthread_t pthread_self(void);
The pthread_self() function returns the ID of the thread in which it is invoked.
In function thread id = 1 In main thread id = 1
This article is contributed by Devanshu Agarwal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Get the stack size and set the stack size of thread attribute in C
- pthread_cancel() in C with example
- pthread_equal() in C with example
- Why variable name does not start with numbers in C ?
- exit() vs _Exit() in C and C++
- Difference between fork() and exec()
- fork() and memory shared b/w processes created using it
- Zombie Processes and their Prevention
- Data Types in C
- fork() in C
- Local Labels in C
- Assertions in C/C++
- Multithreading in C
- How to pass a 2D array as a parameter in C?
- C Language Introduction