//works public List <int> getAvailableTrucks() { List <int> truckNumbers = new List <int>(); if (System.Threading.Monitor.TryEnter(obj6, 45000)) { try { truckNumbers = truckCtr.getAvailableTrucks(); } finally { System.Threading.Monitor.Exit(obj6); } } return(truckNumbers); }