Always Cancel before Close
Document this contract. Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
31dabf0c7d
commit
65665ab807
@ -24,11 +24,12 @@ type Config struct {
|
|||||||
type IO interface {
|
type IO interface {
|
||||||
// Config returns the IO configuration.
|
// Config returns the IO configuration.
|
||||||
Config() Config
|
Config() Config
|
||||||
// Cancel aborts all current io operations
|
// Cancel aborts all current io operations.
|
||||||
Cancel()
|
Cancel()
|
||||||
// Wait blocks until all io copy operations have completed
|
// Wait blocks until all io copy operations have completed.
|
||||||
Wait()
|
Wait()
|
||||||
// Close cleans up all open io resources
|
// Close cleans up all open io resources. Cancel() is always called before
|
||||||
|
// Close()
|
||||||
Close() error
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +191,7 @@ func (p *process) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitS
|
|||||||
return nil, errdefs.FromGRPC(err)
|
return nil, errdefs.FromGRPC(err)
|
||||||
}
|
}
|
||||||
if p.io != nil {
|
if p.io != nil {
|
||||||
|
p.io.Cancel()
|
||||||
p.io.Wait()
|
p.io.Wait()
|
||||||
p.io.Close()
|
p.io.Close()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user