Thread support in 0.10 on OpenBSD
Robert S. Thau
rst at ai.mit.edu
Tue Mar 31 15:24:00 PST 1998
Daniel Veillard writes:
> BTW, I think that this move to setjmp/longjmp is a good move.
> However I remember (I did this kind of user-level threading stuff before)
> that on some platforms the libc implementation checks for the "validity"
> of the stack pointer when longjmp is called.
> For example I had to rewrite setjmp/longjmp on AIX, I may try to
> retrieve that code from archives if there is an use for it. Anybody
> tried recompiling the latest version on AIX ?
I wrote a threads package of my own as part of a private experiment a
while back, with the explicit goal of minimizing the amount of code
needed to port it. AIX was the *only* system of the dozen I tried
which had such error checks in longjmp().
Also, you don't really need to rewrite setjmp() and longjmp() to
defeat the error check. The AIX longjmp() branches to an error
handler called longjmperror() when it detects incorrect usage; there
is a routine with that name in the AIX libc which calls abort(), but
you can also supply your own, and I found it convenient to supply one
which branched back into the middle of longjmp(), after the checks.
This is a truly vile hack, but it reduced the necessary assembly
coding to one line (plus a few pseudo-ops), and was a lot easier to
debug than a rewritten setjmp/longjmp pair would have been
(particularly without any documentation on POWER assembler).
More information about the kaffe