OSDN Git Service

new repo
[bytom/vapor.git] / vendor / golang.org / x / time / rate / rate_go16.go
1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // +build !go1.7
6
7 package rate
8
9 import "golang.org/x/net/context"
10
11 // Wait is shorthand for WaitN(ctx, 1).
12 func (lim *Limiter) Wait(ctx context.Context) (err error) {
13         return lim.waitN(ctx, 1)
14 }
15
16 // WaitN blocks until lim permits n events to happen.
17 // It returns an error if n exceeds the Limiter's burst size, the Context is
18 // canceled, or the expected wait time exceeds the Context's Deadline.
19 func (lim *Limiter) WaitN(ctx context.Context, n int) (err error) {
20         return lim.waitN(ctx, n)
21 }