use pthreads in worker.