MCPcopy Create free account
hub / github.com/godbus/dbus / TestSequentialHandlerSequential

Function TestSequentialHandlerSequential

sequential_handler_test.go:26–43  ·  view source on GitHub ↗

Verifies that signals are written to the destination channel in the order they are received, in a typical concurrent reader/writer scenario.

(t *testing.T)

Source from the content-addressed store, hash-verified

24// Verifies that signals are written to the destination channel in the
25// order they are received, in a typical concurrent reader/writer scenario.
26func TestSequentialHandlerSequential(t *testing.T) {
27 t.Parallel()
28
29 handler := NewSequentialSignalHandler()
30
31 channel := make(chan *Signal, 10)
32 handler.(SignalRegistrar).AddSignal(channel)
33
34 done := make(chan struct{})
35
36 // Concurrently read and write signals
37 go func() {
38 readSignals(t, channel)
39 close(done)
40 }()
41 writeSignals(handler, 1000)
42 <-done
43}
44
45// Test that in the case of multiple destination channels, one channel
46// being blocked does not prevent the other channel receiving messages.

Callers

nothing calls this directly

Calls 4

readSignalsFunction · 0.85
writeSignalsFunction · 0.85
AddSignalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…