added concurrency primatives based on pthreads