public bool TryFreeSharedMemoryMapsForInvocation(string invocationId) { if (!InvocationSharedMemoryMaps.TryRemove(invocationId, out HashSet <string> mapNames)) { _logger.LogTrace("No shared memory maps allocated for invocation id: {Id} by the host", invocationId); return(true); } bool freedAll = true; int numFreed = 0; foreach (string mapName in mapNames) { if (TryFreeSharedMemoryMap(mapName)) { numFreed++; } else { freedAll = false; } } _logger.LogTrace("Freed shared memory maps for invocation id: {Id} - Count: {Count}, FreedAll: {FreedAll}", invocationId, numFreed, freedAll); return(freedAll); }
public void AddSharedMemoryMapForInvocation(string invocationId, string mapName) { HashSet <string> sharedMemoryMaps = InvocationSharedMemoryMaps.GetOrAdd(invocationId, (key) => new HashSet <string>()); sharedMemoryMaps.Add(mapName); }