On Fri, Aug 9, 2019 at 8:34 PM <reik...@gmail.com> wrote:

> The current Go implementation smells of cooperative multitasking. Not a
> bad thing, per se, but makes it hard to stop in certain degenerate cases.
> Have I missed a way to deal with some of the discussed issues?
>
>
My spider sense (intuition) says you might enjoy reading up on the
"context" package in the standard library. The core idea is to create a
"network" of poison channels on which you send messages if things needs to
stop. These channels are used solely for the purpose of managing lifetime
of goroutines, not for normal communication[0] As long as a goroutine
checks for the poison pill eventually, you can send an event to it in order
to stop it. It will require some adaptation to your needs, but I think
there are salvageable ideas in there for you to pursue.

[0] Essentially, you have a bigraph: the message channels forms the
hypergraph part of the bigraph, and the context tree forms one of the tree
sets of the bigraph. The context tree is mapping the "location" of
goroutines, i.e., who belongs together. This allows the conjuration of your
inner Alexandre Dumas: "Un pour tuos, tuos pour un"

-- 
J.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGrdgiXdkuUh7cjOKMw8xdX-Cg-GxjDNzkMMgBRT789fsvYzNQ%40mail.gmail.com.

Reply via email to