CITS2002 Systems Programming  
prev
CITS2002 CITS2002 schedule  

Thread support in C11

All of the examples in this and the previous lecture have used examples involving functions from the pthreads API.

Threading support has been long overdue in the standard C language specification, and it was finally defined in C11.

Before that, the POSIX threads API was used as the primary tool to utilize multi-threaded programming. Since C11 provided a more standard interface that could be used without platform dependencies, it has been recommended to use the ISO language API than the POSIX version. Although the two APIs don't match in their function prototypes, the main features are very similar.

Note that all additions have been to the standard C11 library, and have not added new keywords to the language.

Some helpful references:





And a clever use of (only) a C header file to declare all C11 thread functions 'on top of' an existing pthreads implementation: c11threads.h

 


CITS2002 Systems Programming, Lecture 21, p8, 10th October 2023.