On Thu, Jul 10, 2014 at 09:10:23AM +0200, Werner Fink wrote:
> On Wed, Jul 09, 2014 at 10:13:34AM -0400, Adam Edgar wrote:
> > Very few implementations of malloc are reentrant.  Making malloc thread 
> > safe without locking is not a trivial task. Using malloc within a signal 
> > trap is frowned upon in my experience.
> 
> Indeed, the main problem could be that within signal handlers most
> library functions can become in some cases nonreentrant functions,
> The correct way seems to be (volatile) sig_atomic_t variables and/or
> setjmp/longjmp pair (BSD) or maybe a context switch (SysV).

One expensive solution could be to block the signals if used for traps
and poll with sigtimedwait() for the signal events which then will be
queued by the kernel (POSIX 1003.1b)

Attachment: pgpl6oFUdnJBz.pgp
Description: PGP signature

_______________________________________________
ast-developers mailing list
ast-developers@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to