(nextState State)
| 133 | } |
| 134 | |
| 135 | func (ts *ThreadState) notifySubscribers(nextState State) { |
| 136 | if len(ts.subscribers) == 0 { |
| 137 | return |
| 138 | } |
| 139 | |
| 140 | n := 0 |
| 141 | for _, sub := range ts.subscribers { |
| 142 | if !slices.Contains(sub.states, nextState) { |
| 143 | ts.subscribers[n] = sub |
| 144 | n++ |
| 145 | continue |
| 146 | } |
| 147 | close(sub.ch) |
| 148 | } |
| 149 | |
| 150 | ts.subscribers = ts.subscribers[:n] |
| 151 | } |
| 152 | |
| 153 | // WaitFor blocks until the thread reaches a certain state |
| 154 | func (ts *ThreadState) WaitFor(states ...State) { |
no outgoing calls
no test coverage detected