thread: Move pthread locking utilities into .cpp
thread: Give thread pools a nonblocking mode using spinlocks

This may or may not be better in a Cray MPI context.