Can you generate a patch ?
Sure, attached.  Untested.  The code now looks similar to the beos code.
        /r$
-- 
Rich Salz                  Chief Security Architect
DataPower Technology       http://www.datapower.com
XS40 XML Security Gateway  http://www.datapower.com/products/xs40.html
Attachment:
threads.c.diff
Description: Text document