Continue fighting pthreads.
Clean up thread library a bit too.
19 files changed