2. Threads

“If seven maids with seven mopsSwept it for half a year,Do you suppose,” the Walrus said,“That they could get it clear?”“I doubt it,” said the Carpenter,And shed a bitter tear.

Lewis Carroll, Through the Looking-Glass

Threads are (and perhaps this will come as no surprise) the essential basis of the style of programming that I am advocating. Although this chapter focuses on threads, you will never learn everything you need to know about threads by simply skipping to this chapter and reading it. Threads are a critical part of the landscape, but you can’t do much with only threads. Nevertheless, one must start somewhere, and here we are.

Section 2.1 describes the programming aspects of creating and managing threads in your program, ...

Get Programming with POSIX ® Threads now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.