public void createTask(string taskName, string status, string description) { if (System.Threading.Monitor.TryEnter(obj1, 10000)) { try { TaskControl.createTask(taskName, status, description); } finally { System.Threading.Monitor.Exit(obj1); } } }