Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

5.4. Thread-specific data

No, I’ve made up my mind about it: if I’m Mabel, I’ll stay down here. It’ll be no use their putting their heads down and saying “Come up again, dear!” I shall only look up and say “Who am I, then? Tell me that first, and then, if I like being that person, I’ll come up: if not, I’ll stay down here till I’m somebody else.”

Lewis Carroll, Alice’s Adventures in Wonderland

When a function in a single threaded program needs to create private data that persists across calls to that function, the data can be allocated statically in memory. The name’s scope can be limited to the function or file that uses it (static) or it can be made global (extern).


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial