Completed the pthreads for python part, and fixed the mistakes for the pthreads that were in the cxx file