Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Wiki Markup
*asynchronous-safe* \[[GNU Pth|AA. C References#GNU Pth]\]
A function is "async-safe"asynchronous-safe, or asynchronous-signal safe, if it can be called safely and without side effects from within a signal handler context. That is, it must be able to be interrupted at any point and run linearly out of sequence without causing an inconsistent state. Very few functions are asynchronous-safe. Some asynchronous-safe operations are listed below. If a function does anything not on the list, it is probably not asynchronous-safe:

  • call the signal() function to reinstall a signal handler
  • unconditionally modify a volatile sig_atomic_t variable (as modification to this type is atomic)
  • call the _Exit() function to immediately terminate program execution
  • use a function from the extremely small subset of library functions listed in your signal() documentation as async-safe
  • invoke an async-safe function, as specified by your implementation

Very few functions are asynchronous-safe. If a function performs any other operations, it is probably not asynchronous-safeThis is sometimes referred to as 'asynchronous-signal safe'.

Wiki Markup
*free-standing environment* \[[Banahan 03|AA. C References#Banahan 03]\]
An environment without the C standard libraries. Common for stand-alone programs, such as operating systems or firmware.

...