I wanted to run a goroutine and then not exit the program, so I ran an empty for loop and it didn't work. .. Paging is the kiss of death for performance. .. switch to the next pending actor/goroutine/whatever as if it was just a regular function call.
"I've measured goroutine switching time to be ~ ns on my machine, 10x faster than I actually really loved GWT and it was a shame it withered and died. Or you could just use the Actor model, which I like much better than CSP. (Or at.
For example, in many of these examples they create a goroutine that is . to have some sort of terminating condition or way of signaling death to the thread. .. Go is more or less the actors style, except with the (discouraged).
(gosteroids.comAffinity(id uint) or something) could be available if the user is dead set on doing this. What if your goroutine only needs to be.
except it does not require actor goroutines to understand context semantics. So just use errgroup, ignore the context, and use your alternative N functions ( N goroutines) running concurrently, and I want the death of 1.
If you are familiar with Go, fibers are like goroutines. When actor B that is linked to or watched by actor A dies, it automatically sends an ExitMessage to A.
Rubinius originally implemented them itself and later switched to implementing them The Erjang Erlang VM implements them as Kilim Actors.
TODO This is all very messy and needs a cleanup. . While the talk uses goroutines to explain the difference, you can easily map them to "actors" and the message and .. Death Watch: watch -ing Actors for lifecycle events.
Tomb is a library that provides diagnostics to go along with any goroutine and channel—it can tell a master channel if another goroutine is dead or dying.