public static unsafe Segment *Pop(this ISegmentPool pool) { Segment *result; if (pool.TryPop(out result) == false) { throw new InvalidOperationException("Pool cannot provide more memory"); } return(result); }
public TimerWheel(ActorId thisActor, ISegmentPool pool, IMessageWriter writer, MessageHandler handler, TimeSpan tickLength, Func <long> getTicks, long ticksPerSecond) { _envelope = new Envelope(thisActor); _pool = pool; _handler = handler; _getTicks = getTicks; _store = new SegmentChainMessageStore(writer, pool); var segment = _pool.Pop(); _wheel = (Segment **)segment->Buffer; _segment = segment; // ensure clean wheel for (var i = 0; i < TimeoutsPerSegment; i++) { _wheel[i] = null; } _ticksPerMilisecond = ticksPerSecond / 1000; _clockTickDurationInStopWatch = (long)tickLength.TotalMilliseconds * _ticksPerMilisecond; _startTime = _getTicks(); }
public SegmentChainMessageStore(IMessageWriter writer, ISegmentPool pool) { _writer = writer; _pool = pool; _segmentLength = _pool.SegmentLength; }
internal SegmentStream(ISegmentPool pool) : base(new IndexCalculator(pool.SegmentLength)) { _pool = pool; }
public static SegmentStream GetStream(this ISegmentPool pool) { return(new SegmentStream(pool)); }
public StreamTests() { _pool = new SingleThreadSegmentPool(1024); }
internal SegmentStream(ISegmentPool pool) : base(new IndexCalculator(pool.SegmentLength)) { _pool = pool; }
public TimerWheel(ActorId thisActor, ISegmentPool pool, IMessageWriter writer, MessageHandler handler, TimeSpan tickLength) : this(thisActor, pool, writer, handler, tickLength, Stopwatch.GetTimestamp, Stopwatch.Frequency) { }
public StreamTests() { _pool = new SingleThreadSegmentPool(1024); }