I've tested the patch on both x86 linux and ppc linux and it seems fine.
I've attached a patch that I hacked together to make non threaded x86 systems
(ie MacOS/X and OpenBSD). It's possibly wrong, I'm too tired tonight to trace
through all the ifdefs.