C thread functions?
Hi I wanna ask some question about thread,...
I already understand about thread, mutex and event in Windows (using WinAPI)...
But I think there is another term in threads called 'semaphore', what is it by the way?
Is there portable version of mutex and events functions in C? Only found _beginthread and _beginthreadex in process.h...
The C99 (or earlier) standard doesn't have any support for multithreading. There are portable(ish) libraries that layer on top of native functions, so that you can write code that is portable between Windows and for example Linux. I believe boost (C++) has a good threading library for example. Not sure if there is a pure C library. Someone else may have a suggestion.
It is also, of course, possible to write your own thin layer to hide the actual system functions - you may want to study your target systems different implementations, and find a way to make a subset of all of them.
pthreads is supposed to be pretty good.
And there is a pthreads for win32: http://sourceware.org/pthreads-win32/