Paul 5 年之前
父節點
當前提交
29a36d17c8
共有 2 個檔案被更改,包括 4 行新增3 行删除
  1. 1
    0
      timeout/go.mod
  2. 3
    3
      timeout/run.go

+ 1
- 0
timeout/go.mod 查看文件

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

+ 3
- 3
timeout/run.go 查看文件

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() {