You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// StoppableFunc is a func that receives a stop channel that when closed broadcasts the
51
+
// need to wrap up and stop the function
52
+
typeStoppableFuncfunc(stopchanstruct{})
53
+
50
54
// Stoppable is a function that can be stopped with the method Stop. You can also listen on the Stopped channel to see when it has been stopped.
51
55
// Stoppable is different from a context cancelation because it waits until the function has cleaned up before broadcasting on the Stopped channel
52
56
typeStoppablestruct {
@@ -62,18 +66,34 @@ func (s *Stoppable) Stop() {
62
66
})
63
67
}
64
68
65
-
// Run creates a new stoppable function from the provided func. When you call the Stop method on the returned Stoppable the stop channel fed to the provided func is closed,
66
-
// signaling the need to stop. When the provided func returns the Stopped channel on the
69
+
// Run creates a new stoppable function from the provided funcs. When you call the Stop method on the returned Stoppable the stop channel fed to the provided funcs is closed,
70
+
// signaling the need to stop. When all the provided func return the Stopped channel on the
67
71
// returned Stoppable is closed as well, broadcasting the message that it has finished
0 commit comments