malloc() problem solved(?)

terry a jones jones at acsu.buffalo.edu
Thu Apr 11 04:18:29 AEST 1991


In article <1991Apr10.144136.13350 at virtech.uucp> cpcahil at virtech.uucp (Conor P. Cahill) writes:
>drich at dialogic.com (Dan Rich) writes:
>>So, it looks like the solution to this problem is to not put mallocs
>>in your signal handlers.  :-(
>
>Signal handlers, like the low level kernel stuff, must ensure that 
>they don't do something that will effect the outside world without
>ensuring that they cannot be interrupted.  This includes mallocs, 
>changes to global data (especially pointers), etc.
>


	Or put another way, make sure that your interrupt level code never
calls routines that are not re-entrant, period.  You may get away with it
99.99% of the time, but calling a non re-entrant version of malloc() in an
interrupt thread that has interrupted another thread that was itself 
executing malloc() can give you big trouble.


	Terry


Terry Jones   				{rutgers,uunet}!acsu.buffalo.edu!jones
SUNY at Buffalo ECE Dept.	  or: rutgers!ub!jones, jones at acsu.buffalo.edu



More information about the Comp.unix.sysv386 mailing list