private void UseResource(SystemResource systemResource, int duration) { Console.WriteLine($"Using resource {systemResource.Name}"); Thread.Sleep(duration); FreeResource(systemResource); _queue.Dequeue(); }
private void FreeResource(SystemResource systemResource) { Console.WriteLine($"Freeing resource {systemResource.Name}"); systemResource.Free(); }
public void AddResource(SystemResource systemResource, int duration) { _queue.Enqueue(new ResourceRequest(systemResource, duration)); }