On 2016-10-28 10:37, roger peppe wrote:
FWIW we often use an interface named Worker for long lived processes,
including servers:
type Worker interface {
Kill()
Wait() error
}
Kill asks the worker to die but doesn't block.
Wait waits for the worker to die and returns any error encountered while
running.
Creation of the worker is out of scope of the worker interface - it's a
domain-specific constructor.
Yes... and that seem equivalent to what I described. ... and subject to
the same critique Nick raised.
What will happen when the Worker was not yet running when you call Wait() ?
Will you block forever since it didn't hear Kill() ? ... or will you
exit Wait() immediately, never knowing whether it was actually started,
but just not accepting Kill() yet?
/Peter
--
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.