Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When stack gets destroyed relative to TSD destructors?

0
Posted

When stack gets destroyed relative to TSD destructors?

0

Douglas C. Schmidt wrote: > Can someone please let me know if POSIX pthreads specifies > when a thread stack gets destroyed relative to the time at which the > thread-specific storage destructors get run? In particular, if a > thread-specific destructor accesses a pointer to a location on the > run-time stack, will this memory still exist or will it be gone by the > time the time the destructor runs? Thread-specific data destructors must run in the context of the thread that created the TSD value being destroyed. (This is clearly and unambiguously implied by the standard. That is, while the standard doesn’t explicitly require this, an implementation that called destructors in some other context would present a wide range of severe restrictions in behavior that are not allowed by the standard.) Thus, the stack must exist and remain valid at this point. After a thread has terminated (having completed calling all cleanup handlers and destructors), “the result of access to local (auto) var

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123