Move Go() promise-like func from utils to pkg/promise

This is the first of two steps to break the archive package's dependence
on utils so that archive may be moved into pkg.  Also, the `Go()`
function is small, concise, and not specific to the docker internals, so
it is a good candidate for pkg.

Signed-off-by: Rafe Colton <rafael.colton@gmail.com>
Upstream-commit: b845a62149d5f4990462ac6c9167c5cfaa0e66cb
Component: engine
This commit is contained in:
Rafe Colton
2014-09-29 23:16:27 -07:00
parent ad2a93f102
commit 3ffb3fc6cc
8 changed files with 26 additions and 20 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/jsonlog"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/utils"
)
@@ -246,7 +247,7 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
}()
}
return utils.Go(func() error {
return promise.Go(func() error {
defer func() {
if cStdout != nil {
cStdout.Close()
+2 -1
View File
@@ -27,6 +27,7 @@ import (
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/networkfs/etchosts"
"github.com/docker/docker/pkg/networkfs/resolvconf"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/symlink"
"github.com/docker/docker/runconfig"
"github.com/docker/docker/utils"
@@ -1117,7 +1118,7 @@ func (container *Container) waitForStart() error {
// process or until the process is running in the container
select {
case <-container.monitor.startSignal:
case err := <-utils.Go(container.monitor.Start):
case err := <-promise.Go(container.monitor.Start):
return err
}
+2 -1
View File
@@ -15,6 +15,7 @@ import (
"github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/runconfig"
"github.com/docker/docker/utils"
)
@@ -254,7 +255,7 @@ func (container *Container) Exec(execConfig *execConfig) error {
// We use a callback here instead of a goroutine and an chan for
// syncronization purposes
cErr := utils.Go(func() error { return container.monitorExec(execConfig, callback) })
cErr := promise.Go(func() error { return container.monitorExec(execConfig, callback) })
// Exec should not return until the process is actually running
select {