Xref: utzoo comp.lang.c:32851 comp.std.c:3756 Path: utzoo!attcan!uunet!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c,comp.std.c Subject: Re: Just a minor new twist on free() Message-ID: <21127:Oct1322:38:1390@kramden.acf.nyu.edu> Date: 13 Oct 90 22:38:13 GMT References: <4d5780ad.20b6d@apollo.HP.COM> <10066:Oct1212:30:5790@kramden.acf.nyu.edu> <1990Oct12.162928.21807@watmath.waterloo.edu> Organization: IR Lines: 15 In article <1990Oct12.162928.21807@watmath.waterloo.edu> rbutterworth@watmath.waterloo.edu (Ray Butterworth) writes: > In article <10066:Oct1212:30:5790@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: > >Much better: > > #define free(x) ( ( __frx = x ) , ( __frx ? __frol(__frx) : (void) 0 ) ) > > extern void *__frx; > > extern void (*__frol)(); > Which will blow up if an interrupt occurs and changes the value of __frx > between the assignment and the test, or the test and the __frol call. So what? The system's free() isn't reentrant either. Now do you see something incorrect about my implementation, or are you just posting so you can complain about how difficult it is to use threads in C? If the latter, try proposing some solutions in alt.lang.cfutures. ---Dan