Fixed a couple of race conditions in the wine_pthread routines at