Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
f615b0e2
Commit
f615b0e2
authored
Jan 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d293272d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
go/internal/xcontext/xcontext.go
go/internal/xcontext/xcontext.go
+2
-0
go/internal/xio/xio.go
go/internal/xio/xio.go
+3
-1
No files found.
go/internal/xcontext/xcontext.go
View file @
f615b0e2
...
...
@@ -58,6 +58,8 @@ func Canceled(err error) bool {
//
// func myfunc(ctx, ...) {
// defer xcontext.WhenDone(ctx, func() { ... })()
//
// XXX -> use WithCloseOnErrCancel instead?
func
WhenDone
(
ctx
context
.
Context
,
f
func
())
func
()
{
done
:=
make
(
chan
struct
{})
go
func
()
{
...
...
go/internal/xio/xio.go
View file @
f615b0e2
// Copyright (C) 2017-202
0
Nexedi SA and Contributors.
// Copyright (C) 2017-202
1
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
...
...
@@ -54,6 +54,8 @@ func EOFok(err error) error {
// defer xio.CloseWhenDone(ctx, c)()
//
// The error - if c.Close() returns with any - is logged.
//
// XXX -> use xcontext.WithCloseOnErrCancel instead?
func
CloseWhenDone
(
ctx
context
.
Context
,
c
io
.
Closer
)
func
()
{
return
xcontext
.
WhenDone
(
ctx
,
func
()
{
err
:=
c
.
Close
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment