add pthreads support