ATTN Windows Users: RFC - GCJ/MinGW and Thread-Safe Exception Handling

Adam Megacz
Wed Jul 5 18:04:00 GMT 2006

> Even though that is the case today because of a limitation in
> boehm-gc, it would be better not to make such assumptions. One day -
> according to Hans - it should be possible to create threads outside of
> libgcj and still have them aall into libgcj and allocate java objects
> without crashing.

Okay, this is all starting to come back to me now.

If that is an absolute requirement (be able to throw Java exceptions
in direct-OS-call-spawned-threads), then unless the Win32 API has
changed, you have no choice but to either link to a DLL (which cannot
be statically linked) or else leak a few bytes per spawned thread.

The exception handling mechanism needs that space to hold the SJLJ
state, and the number of threads is variable, so this space must be
malloc()ed.  If you don't know when the thread dies, you can't
deallocate that space.

  - a

More information about the Java mailing list