Ejemplo n.º 1
0
 public static Action <MemoryMappedViewStream> Wrap(SynchronousWritingDelegate externalDelegate)
 {
     return((MemoryMappedViewStream stream) => externalDelegate?.Invoke(stream.AsRandomAccessStream()));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds new message to the queue. This method is thread-safe.
 /// </summary>
 /// <param name="writingDelegate">Custom delegate to write using message's stream.</param>
 /// <param name="length">
 /// Specifies how much memory will be allocated for new message.
 /// Delegate will receive a stream with capacity limited by this parameter, but it is not forced to use all allocated space.
 /// </param>
 /// <param name="timeout">Operation timeout.</param>
 /// <returns>
 /// ChannelStateOperationResult with ChannelState and OperationStatus.Completed, OperationStatus.Timeout,
 /// OperationStatus.DelegateFailed, OperationStatus.RequestedLengthIsGreaterThanLogicalAddressSpace,
 /// OperationStatus.RequestedLengthIsGreaterThanVirtualAddressSpace or OperationStatus.OutOfSpace.
 /// </returns>
 public ChannelStateOperationResult Write(SynchronousWritingDelegate writingDelegate, long length, TimeSpan timeout)
 {
     return(new ChannelStateOperationResult(_internal.Write(DelegateHelper.Wrap(writingDelegate), length, timeout)));
 }