// Constructor is private. Pipe can only be created using // pipepair function. private Pipe(ZObject parent, YPipe<Msg> inpipe, YPipe<Msg> outpipe, int inhwm, int outhwm, bool delay) : base(parent) { m_parent = parent; m_inpipe = inpipe; m_outpipe = outpipe; m_inActive = true; m_outActive = true; m_hwm = outhwm; m_lwm = ComputeLwm (inhwm); m_msgsRead = 0; m_msgsWritten = 0; m_peersMsgsRead = 0; m_peer = null ; m_sink = null ; m_state = State.Active; m_delay = delay; }
///<remarks> Constructor is private as pipe can only be created using <see cref="PipePair"/> method. </remarks> private Pipe(ZObject parent, YPipe <Msg> inboundPipe, YPipe <Msg> outboundPipe, int inHighWatermark, int outHighWatermark, bool delay) : base(parent) { m_parent = parent; m_inboundPipe = inboundPipe; m_outboundPipe = outboundPipe; m_inActive = true; m_outActive = true; m_highWatermark = outHighWatermark; m_lowWatermark = ComputeLowWatermark(inHighWatermark); m_numberOfMessagesRead = 0; m_numberOfMessagesWritten = 0; m_peersMsgsRead = 0; m_peer = null; m_sink = null; m_state = State.Active; m_delay = delay; }
///<remarks> Constructor is private as pipe can only be created using <see cref="PipePair"/> method. </remarks> private Pipe(ZObject parent, YPipe<Msg> inboundPipe, YPipe<Msg> outboundPipe, int inHighWatermark, int outHighWatermark, bool delay) : base(parent) { m_parent = parent; m_inboundPipe = inboundPipe; m_outboundPipe = outboundPipe; m_inActive = true; m_outActive = true; m_highWatermark = outHighWatermark; m_lowWatermark = ComputeLowWatermark(inHighWatermark); m_numberOfMessagesRead = 0; m_numberOfMessagesWritten = 0; m_peersMsgsRead = 0; m_peer = null; m_sink = null; m_state = State.Active; m_delay = delay; }
protected ZObject(ZObject parent) : this(parent.m_ctx, parent.m_tid) { }
public Command(ZObject destination, CommandType type, Object arg) { this.Destination = destination; this.CommandType = type; this.Arg = arg; }
public Command(ZObject destination, CommandType type) : this(destination, type, null) { }
protected ZObject(ZObject parent) : this(parent.m_ctx, parent.m_threadId) { }
// Create a pipepair for bi-directional transfer of messages. // First HWM is for messages passed from first pipe to the second pipe. // Second HWM is for messages passed from second pipe to the first pipe. // Delay specifies how the pipe behaves when the peer terminates. If true // pipe receives all the pending messages before terminating, otherwise it // terminates straight away. public static void Pipepair(ZObject[] parents, Pipe[] pipes, int[] hwms, bool[] delays) { // Creates two pipe objects. These objects are connected by two ypipes, // each to pass messages in one direction. YPipe<Msg> upipe1 = new YPipe<Msg>(Config.MessagePipeGranularity, "upipe1"); YPipe<Msg> upipe2 = new YPipe<Msg>(Config.MessagePipeGranularity, "upipe2"); pipes [0] = new Pipe(parents [0], upipe1, upipe2, hwms [1], hwms [0], delays [0]); pipes [1] = new Pipe(parents [1], upipe2, upipe1, hwms [0], hwms [1], delays [1]); pipes [0].SetPeer (pipes [1]); pipes [1].SetPeer (pipes [0]); }
protected ZObject([NotNull] ZObject parent) : this(parent.m_ctx, parent.m_threadId) { }
public Command([CanBeNull] ZObject destination, CommandType type, [CanBeNull] Object arg = null) { Destination = destination; CommandType = type; Arg = arg; }
/// <summary> Create a pipe pair for bi-directional transfer of messages. </summary> /// <param name="parents">The parents.</param> /// <param name="highWaterMarks">First HWM is for messages passed from first pipe to the second pipe. /// Second HWM is for messages passed from second pipe to the first pipe.</param> /// <param name="delays">Delay specifies how the pipe behaves when the peer terminates. If true /// pipe receives all the pending messages before terminating, otherwise it /// terminates straight away.</param> /// <returns>A pipe pair for bi-directional transfer of messages. </returns> public static Pipe[] PipePair(ZObject[] parents, int[] highWaterMarks, bool[] delays) { // Creates two pipe objects. These objects are connected by two ypipes, // each to pass messages in one direction. YPipe<Msg> upipe1 = new YPipe<Msg>(Config.MessagePipeGranularity, "upipe1"); YPipe<Msg> upipe2 = new YPipe<Msg>(Config.MessagePipeGranularity, "upipe2"); var pipes = new Pipe[2]; pipes[0] = new Pipe(parents[0], upipe1, upipe2, highWaterMarks[1], highWaterMarks[0], delays[0]); pipes[1] = new Pipe(parents[1], upipe2, upipe1, highWaterMarks[0], highWaterMarks[1], delays[1]); pipes[0].SetPeer(pipes[1]); pipes[1].SetPeer(pipes[0]); return pipes; }