public void Access <T>(int id, Action <ContextMemory <T> > callback) where T : class { ContextMemory contextMemory = _memoryCache.Get(id, key => new ContextMemory <T>()); contextMemory.Access(callback); }
public void T() { var contextMemory = new ContextMemory(); var context = (SomeContext *)&contextMemory; context->FirstItem = 10; context->SecondItem = 20; context->FirstItem.Should().Be(10); context->SecondItem.Should().Be(20); (*context).FirstItem.Should().Be(10); (*context).SecondItem.Should().Be(20); ((SomeContext *)&contextMemory)->FirstItem.Should().Be(10); ((SomeContext *)&contextMemory)->SecondItem.Should().Be(20); }
public void ConsoleInit(string[] programNames, int quantum) { this.quantum = quantum; Init(); threads = programNames.Length; contextMemory = new ContextMemory(threads); threadsDuration = new int[threads]; LoadPrograms(programNames); // inicializar estado de los threads threadStates = new ThreadState[threads]; for (int i = 0; i < threads; i++) { threadStates[i] = ThreadState.Running; } currentThread = 0; // se empiza a correr el primer programa en la lista de programas LoadContext(currentThread); }
private static void UnloadHandlerFn(string taskId) { _collector.Unload(ContextMemory.Get(taskId)); }
private static void CollectHandlerFn(string taskId) { _collector.Collect(ContextMemory.Get(taskId)); }