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.
- Difference between C and C#
- scanf("%[^\n]s", str) Vs gets(str) in C with Examples
- time.h localtime() function in C with Examples
- Conditional or Ternary Operator (?:) in C/C++
- C program to Insert an element in an Array
- Types of Literals in C/C++ with Examples
- asctime() and asctime_s() functions in C with Examples
- time.h header file in C with Examples
- __builtin_inf() functions of GCC compiler
- Count substrings that contain all vowels | SET 2
- How can we use Comma operator in place of curly braces?
- Basic Code Optimizations in C
- Constants vs Variables in C language
- Sum of an array using MPI
- Difference between pointer to an array and array of pointers