Skip to content

Commit def6c96

Browse files
Create README.md
1 parent e012149 commit def6c96

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# scheduled-executor
2+
A simple golang library used to mock the famous scheduled thread pool executor in Java.
3+
See example usage below
4+
```Go
5+
6+
package main
7+
8+
import (
9+
"fmt"
10+
"github.com/gbenroscience/scheduled-executor/utils"
11+
"time"
12+
)
13+
14+
15+
func timeStampMillis() int {
16+
return int(time.Now().UnixNano() / 1000000)
17+
}
18+
19+
func main() {
20+
21+
22+
totalCount := 0
23+
24+
utils.NewTimedExecutor(2 * time.Second , 2 * time.Second).Start(func() {
25+
totalCount++
26+
fmt.Printf("%d.%4stime is %d\n" ,totalCount , " ", timeStampMillis())
27+
} , true)
28+
29+
30+
time.Sleep(time.Minute)
31+
32+
33+
34+
}
35+
36+
37+
```

0 commit comments

Comments
 (0)