Include `pthread.h` before using pthreads functions

Fixes build on OpenBSD
Merge pull request #141 from avsm/pthread-include-fix

Include `pthread.h` before using pthreads functions