Tested multiple concurrent workers.
diff --git a/disruptor_test.go b/disruptor_test.go
index 7ff4bf2..65fb99b 100644
--- a/disruptor_test.go
+++ b/disruptor_test.go
@@ -11,14 +11,19 @@
cursor := NewSequence()
handler := func(value uint64) {}
worker1 := NewWorker(cursor, handler, WaitStrategy)
- worker2 := NewWorker(cursor, handler, WaitStrategy)
- workers := []Worker{worker1, worker2}
+ // worker2 := NewWorker(cursor, handler, WaitStrategy)
+ // worker3 := NewWorker(cursor, handler, WaitStrategy)
+ // worker4 := NewWorker(cursor, handler, WaitStrategy)
+ workers := []Worker{worker1 /*, worker2, worker3, worker4*/}
+
+ // TODO: multi-producer sequencer
+ // TODO: diamond gating workers, e.g. 1 runs, then 2&3 simultaneously after 1, then 4 after 2&3 are done.
+ // TODO: DSL
go func() {
for current, max := uint64(0), uint64(0); current < iterations; {
for current >= max {
max = minSequence(workers) + BufferSize
- //max = worker.sequence.atomicLoad() + BufferSize
time.Sleep(WaitStrategy)
}
@@ -29,8 +34,10 @@
cursor.close()
}()
- go worker1.Process()
- worker2.Process()
+ // go worker4.Process()
+ // go worker3.Process()
+ // go worker2.Process()
+ worker1.Process()
}
func minSequence(workers []Worker) uint64 {
min := Uint64MaxValue