Added mutex locks to ensure that no 2 daemons can run at the same time.