mirror of
https://github.com/rclone/rclone.git
synced 2025-12-16 00:04:40 +00:00
vendor: update all dependencies
This commit is contained in:
9
vendor/golang.org/x/net/context/withtimeout_test.go
generated
vendored
9
vendor/golang.org/x/net/context/withtimeout_test.go
generated
vendored
@@ -11,16 +11,21 @@ import (
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// This example passes a context with a timeout to tell a blocking function that
|
||||
// it should abandon its work after the timeout elapses.
|
||||
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)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond)
|
||||
defer cancel()
|
||||
|
||||
select {
|
||||
case <-time.After(200 * time.Millisecond):
|
||||
case <-time.After(1 * time.Second):
|
||||
fmt.Println("overslept")
|
||||
case <-ctx.Done():
|
||||
fmt.Println(ctx.Err()) // prints "context deadline exceeded"
|
||||
}
|
||||
|
||||
// Output:
|
||||
// context deadline exceeded
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user