static async void A2(ILockManager manager) { // wait one second await Task.Delay(1000); // check if it's locked LockToken existingLock = await manager.QueryAsync("tandem://devices/Wow"); if (existingLock.IsValid) { Console.WriteLine($"It's locked by '{existingLock.Owner}'"); } // now try and obtain a lock await Task.Delay(2000); using (var h = await manager.LockAsync("tandem://devices/wow")) { if (h == null) { Console.WriteLine("Couldn't get a lock!"); } else { Console.WriteLine("Got a lock!"); ProceedSemaphore.Release(); } } }