diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-05-28 21:51:39 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-28 21:51:39 +0000 |
commit | 78d4cf6d3a7ce48cd011909c4a5bc2b7cd44e139 (patch) | |
tree | 79d8f9ddd1fad7979765bf38fa8a9c8857b7ad52 /runsc/specutils | |
parent | 8863131d5411013637268f05bd944128898e42af (diff) | |
parent | f7418e21590e271302a3c375323950c209ce5ced (diff) |
Merge release-20200522.0-25-gf7418e21 (automated)
Diffstat (limited to 'runsc/specutils')
-rw-r--r-- | runsc/specutils/specutils.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/runsc/specutils/specutils.go b/runsc/specutils/specutils.go index 837d5e238..f1fa573c5 100644 --- a/runsc/specutils/specutils.go +++ b/runsc/specutils/specutils.go @@ -444,36 +444,6 @@ func ContainsStr(strs []string, str string) bool { return false } -// Cleanup allows defers to be aborted when cleanup needs to happen -// conditionally. Usage: -// c := MakeCleanup(func() { f.Close() }) -// defer c.Clean() // any failure before release is called will close the file. -// ... -// c.Release() // on success, aborts closing the file and return it. -// return f -type Cleanup struct { - clean func() -} - -// MakeCleanup creates a new Cleanup object. -func MakeCleanup(f func()) Cleanup { - return Cleanup{clean: f} -} - -// Clean calls the cleanup function. -func (c *Cleanup) Clean() { - if c.clean != nil { - c.clean() - c.clean = nil - } -} - -// Release releases the cleanup from its duties, i.e. cleanup function is not -// called after this point. -func (c *Cleanup) Release() { - c.clean = nil -} - // RetryEintr retries the function until an error different than EINTR is // returned. func RetryEintr(f func() (uintptr, uintptr, error)) (uintptr, uintptr, error) { |