Adding a lock system per application to protect sending from multi thread