oci: Copy-edits for waitContainerStop chControl comment

The old "won't never" was a potentially-confusing double negative.
This commit rewords the comment to avoid that issue and also lands
some other minor cleanups.

Signed-off-by: W. Trevor King <wking@tremily.us>
This commit is contained in:
W. Trevor King 2018-02-14 10:11:51 -08:00
parent fa8cedf981
commit db3962cbc9

View file

@ -563,12 +563,12 @@ func (r *Runtime) UpdateContainer(c *Container, res *rspec.LinuxResources) error
func waitContainerStop(ctx context.Context, c *Container, timeout time.Duration) error { func waitContainerStop(ctx context.Context, c *Container, timeout time.Duration) error {
done := make(chan struct{}) done := make(chan struct{})
// we could potentially re-use "done" channel to exit the loop on timeout // we could potentially re-use "done" channel to exit the loop on timeout,
// but we use another channel "chControl" so that we won't never incur in the // but we use another channel "chControl" so that we never panic
// case the "done" channel is closed in the "default" select case and we also // attempting to close an already-closed "done" channel. The panic
// reach the timeout in the select below. If that happens we could raise // would occur in the "default" select case below if we'd closed the
// a panic closing a closed channel so better be safe and use another new // "done" channel (instead of the "chControl" channel) in the timeout
// channel just to control the loop. // select case.
chControl := make(chan struct{}) chControl := make(chan struct{})
go func() { go func() {
for { for {