[Gc] GC + dylibs on Darwin/OS X

Brian Alliet brian@brian-web.com
Tue, 11 Mar 2003 01:04:19 -0500


On Tuesday, March 11, 2003, at 12:43  AM, Jesse Rosenstock wrote:

> I still don't think it's right because if I always use
> the same semaphore names in different processes and take out the
> exponential backoff for retrying, it still crashes.

I've been banging my head against the wall trying all sorts of 
different things too. I even went so far as to make a very crude 
semaphore implementation in terms of mach calls. (No modifications to 
the kernel, just calls to mach thread_* calls). That actually seems to 
work. A combination of this and a slightly modified GC_test_and_set 
function (based on a suggestion from Hans) seems to have eliminated all 
of the crashes. Unfortunately the locking up problem is still there. 
Fortunately though, its not blowing up gdb anymore.

(gdb) thread 2
[Switching to thread 2 (process 19342 thread 0x3c03)]
#0  0x9000fa40 in _sigtramp ()
(gdb) where
#0  0x9000fa40 in _sigtramp ()

Basically, every once and a while some thread will get "stuck" in 
_sigtramp (whatever that is) and GC_stop_world () will just keep trying 
to send it a suspend signal. I'm not really sure where to begin 
debugging this. I'll try to get a cleaned up patch together and post it 
sometime tomorrow.

> Why couldn't Apple have implemented sem_init?  It looks like it would 
> be
> very simple.  I'd do it and send them the patch, but the when I tried
> compiling an (unmodified) kernel, it didn't boot.  Does anyone have an
> ideas there?

Even if you did make a patch, I'd imagine it would take a while to get 
it into an official release (but I don't really know, I don't follow 
the darwin development too much). The GC already depends on 10.2 for 
pthread_kill, I wouldn't want it to now depend on 10.3 or something. I 
can't help you on compiling your own kernel, I've never tried that, you 
might want to check the darwin mailing lists.

-Brian