liveBook · Manning

Thread storage duration

As explained in Modern C

Thread storage duration is a C storage duration in which an object's lifetime is associated with a particular thread of execution.

Thread storage duration is the C storage duration in which an object's lifetime is bound to a particular thread of execution. An object can be accessed only during its lifetime; referring to it before that lifetime begins or after it ends has undefined behavior. section 13.2

Thread storage duration belongs to the broader model of object storage and initialization:

  • C distinguishes static, automatic, allocated, and thread storage durations. section 13.2
  • Thread duration binds an object to one thread of execution rather than to the whole program, a block, or an explicit allocation operation. section 13.2
  • Objects with thread storage duration receive default initialization; this initializes their members as if to zero. section 13.4
  • The storage duration determines how initialization works, while lifetime rules determine when access is valid. section 13.2 section 13.4

How Modern C covers it

How deep it goes
Defines thread binding, lifetime boundaries, and default initialization but does not develop a thread-specific code example.
What it assumes
Explains object lifetime and the four storage-duration categories alongside the concept rather than assuming them silently.
What you can do after
Evaluate whether an object's lifetime and default initialization follow a particular thread rather than another storage-duration rule.
How it connects
Connects thread storage duration with object lifetime, initialization, static storage duration, automatic storage duration, and allocated storage duration.

Also explained in

Compare how 2 books explain thread storage duration →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C. The section links point to the parts of the book it draws on.