Since C Language does not provide any object oriented concepts, I wonder whether it also does not have support for multi-threading? I searched on the web - can anyone give me answer regarding this?
-
2Multi-threading is certainly not dependant of object oriented concepts. Take a look at the pthread library: https://computing.llnl.gov/tutorials/pthreads/. – Simon Sep 23 '11 at 05:25
-
7I'm not trying to be a jerk, but no, you didn't search for it: [Google "multithreading in c"](http://www.google.com/search?q=multithreading%20in%20c) – Blender Sep 23 '11 at 05:27
-
Possible duplicate of [How do I start threads in plain C?](https://stackoverflow.com/questions/56810/how-do-i-start-threads-in-plain-c) – Ciro Santilli OurBigBook.com Sep 22 '18 at 03:57
5 Answers
With C11, the language has full support for threading, including the memory model it inherited from C++11. It has facilities for threads, condition variables, mutexes and thread local storage, for instance.
Prior to C11, people typically used pthreads on unix systems and CreateThread on windows, which was supported via implementation defined behavior (not the C standard). Multithreading behavior would mostly defer to the behavior of that hardware.

- 10,915
- 1
- 32
- 40
C is un-doubtfully have multi-threading support. Check out pthread. And here is an tutorial on pthread:

- 563
- 1
- 3
- 14
-
No, you are wrong. There are extensions that add this at top of C, but no current standard (c99) do support threading. Posix Threads are not part of C standard. – Tomas Pruzina Sep 23 '11 at 19:48
Whether a language is Object Oriented or not doesn't affect it's support for threading.
Yes you can use threads with C and there are various libraries you can use to do this, pthreads being one of them.

- 11,704
- 6
- 44
- 58
C1X will support threading, but right now, there is no such thing in c99. Peeople do use less portable extensions like POSIX threads (pthreads), forking etc.
Standard C1X is still a draft and support from compilers is somewhat lacking, gcc partially support it, but I heard threading isnt complete yet (I mean, unstable, dev version of gcc, not 4.6).

- 8,397
- 6
- 26
- 39