Re: [AD] mzscheme bindings in svn |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Peter Wang wrote:
I was thinking a problem might occur when allegro is initialized via a scheme thread so other scheme things are going on and a write-barrier is hit while Allegro is being initialized. I'm sure its incredibly unlikely but if the situation ever arose the programmer would go bonkers trying to debug it.On 2007-04-28, Jon Rafkind <workmin@xxxxxxxxxx> wrote:I think messing with the invariants about the garbage collector is tricky business and might lead to very strange results.That would be fine (but call it __al_xwin_dont_install_signal_handlers or something). A dirtier solution would be to save the MzScheme signal handlers before calling allegro_init(), then restore them immediately afterwards. This would work with current and older versions of Allegro.I don't think it's that tricky. During the short time that Allegro is initialising we wouldn't be writing to any pages which MzScheme has marked as read-only (I'm assuming that's how it works) and we'd restore it straight after. Disabling *all* of Allegro's emergency signal handlers seems overkill.
Alright. I thought it would be best to not use global variables but indeed it adds a lot of code overhead.I'd rather useAttached is a patch that more or less does this. Calling enable_signal_handlers/disable_signal_handlers() will result in calling enable_signals() for each driver listed in the system_list if system_driver has not been initialized, otherwise it just calls system_driver->enable_signals(). This is done because you need to enable/disable signal handlers before the system driver init() method is called so there is no way to know which system driver is being used until allegro_init() finds the right driver.the _al_xwin_install_signal_handlers way.We definitely don't want to be adding to the namespace pollution with enable_signal_handlers(). It doesn't need to be part of the official API. I think an internal global variable is enough for this anyway.
I tried to take a good deal of care making this patch. Strangely all the code in src/linux uses tabs instead of 3 spaces. I just went with the flow.Peter PS. Please be more careful with formatting, otherwise we just need to waste time fixing it up before committing.
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |