From: Eric Wong Date: 2013-02-25T05:20:20+09:00 Subject: [ruby-core:52848] Re: [ruby-trunk - Feature #7918][Open] Create Signal.in_trap?() SASADA Koichi wrote: > (2013/02/23 11:31), kosaki (Motohiro KOSAKI) wrote: > > Currently, ruby library have no way to detect a method is called from trap handler or not. > > This is useful because Mutex#lock under trap raises an exception and some libraries may want to avoid it. > > I'm not sure why it is useful. If a lock is needed, then the lock should > be acquired in trap handler (and not supported yet). Detecting it is in > trap, and do what? How about allowing Mutex#lock to be recursive if (and only if) called inside trap?