Adding locking mechanims for thread or process sync, based on lockfile.