On Oct 28, 2016 14:48, "Peter Mogensen" <a...@one.com> wrote:
>
> So ... bottom line ... defining Server objects as one-shot/single-use
allows you to define the Kill()/Shutdown() semantics to simply exhaust that
single-use. (an being idempotent) ... making it irrelevant whether the
server has actually been started, since any call to Serve() would just exit
immediately when the Server has been invalidated by Kill()/Shutdown()
>

Yes

> This would then require a 3rd method Reset() to make the server
restartable.
>

Yes. There could be other protocols that allow this as well (e.g. the
WaitStarted you described). But Reset() is one of them.

> Not having servers being single-use would mean you don't know which
Serve() invocation you are killing and you would solve the question of
whether to queue Shutdown() events or throw some of them away... and more
problematic... a caller of Kill()/Shutdown() will have to have someway to
know whether it makes sense to Wait() for a Serve() - and which Serve()
that is.

Yes... Provided that by "not single use" you mean restartable. In this case
there are always small windows of time when you don't know which of two
consecutive runs will receive the Shutdown().

> Context solves that problem, since it gives an explicit reference to each
Serve() invocation from the outside.

Yes

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to