How to write a thread program in c? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to write a thread program in c?

Multithreading or in short threading in c

29th Jan 2018, 2:46 AM
Hacked
2 Answers
+ 14
Unlike Java, multithreading is not supported by the language standard.ย POSIX Threads (or Pthreads)ย is a POSIX standard for threads. Implementation of pthread is available with gcc compiler. For more ๐Ÿ‘‡ https://www.geeksforgeeks.org/multithreading-c-2/
29th Jan 2018, 4:23 AM
๐ŸŒ›DT๐ŸŒœ
๐ŸŒ›DT๐ŸŒœ - avatar
+ 3
Use the C11 threads.h: http://en.cppreference.com/w/c/thread Note: You must use the musl library instead of glibc, as it's the only library I know of that implements the header. Edit: Here's a small header file that implements the threads.h interface on top of POSIX threads: https://github.com/jtsiomb/c11threads
29th Jan 2018, 4:58 AM
Vlad Serbu
Vlad Serbu - avatar