/// <summary> /// Send a serializable object through the shared memory /// and wait for it to be picked up. /// </summary> /// <param name="transferObject"> </param> public TransferItemType ShareObject(TransferItemType transferObject) { try { var ptr = EntityPtr.ToPointerWithOffset(transferObject); // Write out how long this object is. var typesize = transferObject.SizeOf(); // Write out the bytes. WinApi.memcpy((IntPtr)((int)ptrToMemory), ptr, typesize); return(EntityPtr.ToInstanceWithOffset <TransferItemType>((IntPtr)((int)ptrToMemory))); } finally { // Signal the other process using the mutex to tell it // to do receive processing. semaphoreRecieve.Release(); } }
public unsafe T AsSharedType(T obj) { *(int *)EntityPtr.ToPointerWithOffset(obj) = (int)methodsTable; // rewrite mt to new return(obj); }
public void Free(TPoolItem obj) { _freeObjects[_freeSize] = EntityPtr.ToPointerWithOffset(obj); _freeSize++; }