Method Pike.signal_contextp()
- Method
signal_contextp
bool
signal_contextp()- Description
Returns whether the current thread is running in a signal handler context.
A signal handler context implies that ordinary program flow for the current thread has been interrupted (note that other threads will continue to execute concurrently), and will resume when the handler returns. Note that code that is executing in a signal context may still be interrupted.
Some origins for entering a signal handler context are:
A caught signal triggering a signal handler to be called.
An object implementing lfun::_destruct() running out of references or being destructed by the gc().
An uncaught runtime error (causing MasterObject()->handle_error() to be called).
In a signal handler context some operations are not supported eg locking of Thread.Mutex or waiting on Thread.Condition.
Intended use is to be able to throw errors early in APIs that are not signal context safe, or to be able to detect this and upgrade the call to a normal context (eg via call_out()).
- See also
lfun::_destruct(), call_out(), gc(), MasterObject()->handle_error()