Thread-safe and reentrant functions

I personally understand reentrant functions as follows:

  • Reentrant function reentrant need to specify the object, the thread into reentrant function and the signal function reentrant
  • Function thread reentrant function can be called simultaneously by multiple threads, and to ensure safe, also known as thread-safe function
  • Reentrant function signal in the signal processing program is guaranteed to be called safety function, the safety function is also called an asynchronous signal

The figure is mentioned in the book APUE POSIX.1 does not guarantee thread-safe function, in other words, a function not included in the figure are thread-reentrant functions.

And by comparison of the signal reentrant function, not difficult to draw the following conclusions:

  • All signals reentrant functions are thread-safe function
  • Thread-safe, asynchronous signal may not be safe

Guess you like

Origin www.cnblogs.com/songhe364826110/p/11517101.html