Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
0c73722a
Commit
0c73722a
authored
Nov 15, 2015
by
Jeromy
Browse files
vendor in notifier
parent
d4b42f8e
Changes
82
Hide whitespace changes
Inline
Side-by-side
vendor/QmacZi9WygGK7Me8mH53pypyscHzU386aUZXpr28GZgUct/context/package.json
0 → 100644
View file @
0c73722a
{
"name"
:
"context"
,
"author"
:
"whyrusleeping"
,
"version"
:
"1.0.0"
,
"language"
:
"go"
,
"gx"
:
{
"dvcsimport"
:
"golang.org/x/net/context"
}
}
\ No newline at end of file
vendor/QmacZi9WygGK7Me8mH53pypyscHzU386aUZXpr28GZgUct/context/withtimeout_test.go
0 → 100644
View file @
0c73722a
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
context_test
import
(
"fmt"
"time"
"QmacZi9WygGK7Me8mH53pypyscHzU386aUZXpr28GZgUct/context"
)
func
ExampleWithTimeout
()
{
// Pass a context with a timeout to tell a blocking function that it
// should abandon its work after the timeout elapses.
ctx
,
_
:=
context
.
WithTimeout
(
context
.
Background
(),
100
*
time
.
Millisecond
)
select
{
case
<-
time
.
After
(
200
*
time
.
Millisecond
)
:
fmt
.
Println
(
"overslept"
)
case
<-
ctx
.
Done
()
:
fmt
.
Println
(
ctx
.
Err
())
// prints "context deadline exceeded"
}
// Output:
// context deadline exceeded
}
Prev
1
2
3
4
5
Next
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