change makefile pthread
adding mutex
find bug in exit