Merge "<pthread.h> fixes and pthread cleanup."