pthreads mean calculation