Reentrant-safe versus thread-safe

How exactly is reentrant-safe different from thread-safe? Confusion does prevail. Here's a concise take: reentrant safety is an older issue prior to the advent of multitasking and multithreading OSes, the implication being that only one thread of concern is executing. For a function to be reentrant-safe, it should be able to be correctly re-invoked from another context while the previous context has not yet completed execution (think of a signal handler re-invoking a given function while it is already executing). The key requirement: it should use only local variables or have the ability to save and restore the global it uses such that it's safe. (These ideas have been dealt with in Chapter 11, Signaling ...

Get Hands-On System Programming with Linux 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.