Starting to implement the pthreads version.