Pthreads and matrix operations