Here is a small code fragment that will reproduce the problem. Must be run MAC OSX, version 10.6+ with sbcl compiled with threads (or use macports version with +threads option when compiling):
No, unfortunately there isn't a convenient mechanism to automaticallyOn 11 August 2010 18:03, Kevin Smith <email@example.com> wrote:
> Sorry if I asked this already, but is there any way to insure foreign
> libraries are loaded on the initial thread for sbcl built with threads ?
> There is a problem with certain MAC OSX libraries (in 10.6, snow leopard)
> in this regard (like OpenGL, for example). They can only be loaded in
> initial thread or cause breakpoint exceptions otherwise. Maybe sbcl already
> takes care of this ?
do this for all foreign libraries.
* If an application, just take care to load all foreign code in the
* If a library, document the need to be loaded in the initial thread.
(And make sure you're not doing any lazy loading!)
That said, there is one option that you _could_ use, but which is
really bad and I STRONGLY recommend against it. Grab a reference to
the initial thread and use INTERRUPT-THREAD to call LOAD-SHARED-OBJECT
there. Don't do this, really.
Apropos, can you post a snippet of code that shows how to provoke the error?