Example #1
0
            public readonly void ApplySyncInMainThread()
            {
                // Allocate the requested amount of elements
                long sizeInBytes = Extent * Interop.SizeOf <T>();
                var  allocation  = UnmanagedMemoryViewSource.Create(sizeInBytes);

                // Publish the allocated shared memory source
                Parent.currentSharedMemorySource = allocation;
                Parent.sharedMemory.Add(allocation);
            }
Example #2
0
 public static ArrayView <T> Allocate <T>(long extent)
     where T : unmanaged
 {
     Trace.Assert(extent >= 0, "Invalid extent");
     return(new ArrayView <T>(
                UnmanagedMemoryViewSource.Create(
                    Interop.SizeOf <T>() * extent),
                0,
                extent));
 }