public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* determine whether code is running in a signal handler context
@ 2017-10-18 14:18 Yubin Ruan
  2017-10-18 18:34 ` Carlos O'Donell
                   ` (4 more replies)
  0 siblings, 5 replies; 31+ messages in thread
From: Yubin Ruan @ 2017-10-18 14:18 UTC (permalink / raw)
  To: libc-help

Hi,

I am writing to see if this is any util functions in libc that can
help to determine it is currently running in a signal.

I wrote some library and provide a function which will be used in many
client code. However this function is not async-signal safe (it calls
malloc(3)) so when it is called, I want to detect whether it is
currently running in a signal handler. If it is, I can avoid calling
those not-async-signal-safe functions which might cause deadlock.

that is, I want a `in_signal_handler_context()' utility that can be
used as this:

int mylibfunc( void ) {
    if( in_signal_handler_context() ) { return(-1) }
    // rest of function goes here
    return( 0 );
}


Yubin

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2017-11-27 12:58 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-18 14:18 determine whether code is running in a signal handler context Yubin Ruan
2017-10-18 18:34 ` Carlos O'Donell
2017-10-19  1:52   ` Yubin Ruan
2017-10-19  2:19     ` Carlos O'Donell
2017-10-19  2:39       ` Will Hawkins
2017-10-19  3:12         ` Carlos O'Donell
2017-10-19  4:07           ` Yubin Ruan
2017-10-19  4:56             ` Carlos O'Donell
2017-10-19  4:19           ` Will Hawkins
2017-10-19  4:01       ` Yubin Ruan
2017-10-19  2:59 ` Sean Conner
2017-10-19  3:12 ` Sean Conner
2017-10-19  3:51   ` Yubin Ruan
2017-10-19  7:10     ` Jeffrey Walton
2017-10-20 10:32 ` Szabolcs Nagy
2017-10-20 11:23   ` Yubin Ruan
2017-10-20 11:31     ` Szabolcs Nagy
2017-10-20 17:19       ` Carlos O'Donell
2017-10-20 17:48         ` Szabolcs Nagy
2017-10-22  6:09           ` Carlos O'Donell
2017-10-22 23:39             ` where is the definition of idtype_t supposed to live? John Lumby
2017-10-23 13:57               ` Florian Weimer
     [not found]                 ` <BN6PR22MB16662DE3DFB590B3D6006F81A3460@BN6PR22MB1666.namprd22.prod.outlook.com>
2017-10-23 14:20                   ` Florian Weimer
2017-10-23 10:01             ` determine whether code is running in a signal handler context Szabolcs Nagy
2017-10-23 14:30               ` Carlos O'Donell
2017-10-24  1:00                 ` Yubin Ruan
2017-11-27  8:43 ` Yubin Ruan
2017-11-27 11:55   ` Florian Weimer
2017-11-27 12:50     ` Yubin Ruan
2017-11-27 12:51       ` Florian Weimer
2017-11-27 12:58         ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).