Are All Reentrant Functions Thread Safe?
Hence, a Thread-Safe Function Is Always Reentrant, but a Reentrant Function Is Not Always Thread-Safe. by Extension, a Class Is Said to Be Reentrant If Its...
Hence, a thread-safe function is always reentrant, but a reentrant function is not always thread-safe. By extension, a class is said to be reentrant if its member functions can be called safely from multiple threads, as long as each thread uses a different instance of the class.
What is the difference between thread-safe and reentrant?
An operation is “thread-safe” if it can be performed from multiple threads safely, even if the calls happen simultaneously on multiple threads. An operation is re-entrant if it can be performed while the operation is already in progress (perhaps in another context).
What makes a function not thread-safe?
If the code fails when multiple threads execute it from different processes, then, arguably, (the "shared memory" might be in a disk file), it is NOT thread safe !!