/// <summary> /// Register memory region. /// </summary> /// <param name="msg"></param> private static void RegisterMemoryRegionMessageCallback(MlosProxyInternal.RegisterMemoryRegionRequestMessage msg) { if (!MemoryRegions.ContainsKey(msg.MemoryRegionId)) { SharedMemoryMapView sharedMemoryMapView = SharedMemoryMapView.Open( msg.Name.Value, msg.MemoryRegionSize); MemoryRegions.Add(msg.MemoryRegionId, sharedMemoryMapView); } }
public void VerifySharedMemoryMapUnlink() { // Create a new shared memory maps. // var newsSharedChannelMemoryMap = SharedMemoryMapView.Create(SharedMemoryMapName, SharedMemorySize); newsSharedChannelMemoryMap.CleanupOnClose = true; newsSharedChannelMemoryMap.Dispose(); try { // Verify we can open already created shared memory. // using var openedSharedChannelMemoryMap = SharedMemoryMapView.Open(SharedMemoryMapName, SharedMemorySize); newsSharedChannelMemoryMap.CleanupOnClose = true; Assert.False(true, "Shared memory map should be deleted"); } catch (FileNotFoundException) { // We are expecting failure. // } }