Paul 6 years ago
parent
commit
29a36d17c8
2 changed files with 4 additions and 3 deletions
  1. 1
    0
      timeout/go.mod
  2. 3
    3
      timeout/run.go

+ 1
- 0
timeout/go.mod View File

1
+module git.links123.net/links123.com/pkg/timeout

+ 3
- 3
timeout/run.go View File

5
 	"time"
5
 	"time"
6
 )
6
 )
7
 
7
 
8
-type ExecuteChan struct {
8
+type executeChan struct {
9
 	c    chan bool
9
 	c    chan bool
10
 	once sync.Once
10
 	once sync.Once
11
 }
11
 }
12
 
12
 
13
-// 返回函数f是否被运行
13
+//Run 返回函数f是否被运行
14
 func Run(limit time.Duration, f func()) bool {
14
 func Run(limit time.Duration, f func()) bool {
15
-	ec := &ExecuteChan{c: make(chan bool), once: sync.Once{}}
15
+	ec := &executeChan{c: make(chan bool), once: sync.Once{}}
16
 	whether := true
16
 	whether := true
17
 
17
 
18
 	go func() {
18
 	go func() {