Ejemplo n.º 1
0
        public void Detach()
        {
            if (CurrentState == State.Idle || CurrentState == State.Detached)
            {
                return;
            }

            Memory.UninitializeMapping();

            if (codeCacheHandle != null)
            {
                FileMapping.UnmapViewOfFile(codeCachePtr);
                codeCacheHandle.Close();
                codeCacheHandle = null;
            }
            if (memoryHandle != null)
            {
                memoryHandle.Close();
                memoryHandle = null;
            }

            if (socket != null)
            {
                socket.Close();
                socket = null;
            }

            OnStateChanged(State.Detached);
        }
Ejemplo n.º 2
0
 public void UninitializeMapping()
 {
     foreach (MapInfo mapInfo in mapInfos)
     {
         FileMapping.UnmapViewOfFile(mapInfo.ptr);
         mapInfo.ptr = IntPtr.Zero;
     }
 }