Fixed Posix mutex and thread