/// <summary>
        /// Claims the resources.
        /// </summary>
        /// <param name="hardwareResources">The hardware resources.</param>
        /// <returns></returns>
        public bool ClaimResources(HardwareResources hardwareResources)
        {
            lock (_lock)
            {
                for (byte r = 0; r < hardwareResources.MemoryRegionCount; r++)
                {
                    var region = hardwareResources.GetMemoryRegion(r);

                    foreach (var memoryRegion in memoryRegions)
                    {
                        if (memoryRegion.Contains(region.BaseAddress) || memoryRegion.Contains(region.BaseAddress + region.Size))
                        {
                            return(false);
                        }
                    }
                }

                for (byte r = 0; r < hardwareResources.MemoryRegionCount; r++)
                {
                    memoryRegions.AddLast(hardwareResources.GetMemoryRegion(r));
                }
            }

            return(true);
        }
 /// <summary>
 /// Releases the resources.
 /// </summary>
 /// <param name="hardwareResources">The hardware resources.</param>
 public void ReleaseResources(HardwareResources hardwareResources)
 {
     lock (_lock)
     {
         for (byte r = 0; r < hardwareResources.MemoryRegionCount; r++)
         {
             memoryRegions.Remove(hardwareResources.GetMemoryRegion(r));
         }
     }
 }
        /// <summary>
        /// Releases the resources.
        /// </summary>
        /// <param name="hardwareResources">The hardware resources.</param>
        public void ReleaseResources(HardwareResources hardwareResources)
        {
            spinLock.Enter();

            for (byte r = 0; r < hardwareResources.MemoryRegionCount; r++)
            {
                memoryRegions.Remove(hardwareResources.GetMemoryRegion(r));
            }

            spinLock.Exit();
        }