How to determine if code is running in signal-handler context?

前端 未结 6 1232
一生所求
一生所求 2021-02-03 11:11

I just found out that someone is calling - from a signal handler - a definitely not async-signal-safe function that I wrote.

So, now I\'m curious: how to circumvent this

6条回答
  •  臣服心动
    2021-02-03 11:12

    You could work out something using sigaltstack. Set up an alternative signal stack, get the stack pointer in some async-safe way, if within the alternative stack go on, otherwise abort().

提交回复
热议问题