Skip to content

Commit 7eebd51

Browse files
committed
all: doc updates
1 parent 0d9ae2c commit 7eebd51

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# mainthread [![PkgGoDev](https://pkg.go.dev/badge/golang.design/x/mainthread)](https://pkg.go.dev/golang.design/x/mainthread) ![mainthread](https://github.com/golang-design/mainthread/workflows/mainthread/badge.svg?branch=main) ![](https://changkun.de/urlstat?mode=github&repo=golang-design/mainthread)
22

3-
schedules function to run on the main thread
3+
schedule functions to run on the main thread
44

55
```go
66
import "golang.design/x/mainthread"
@@ -15,7 +15,7 @@ import "golang.design/x/mainthread"
1515

1616
Package mainthread offers facilities to schedule functions
1717
on the main thread. To use this package properly, one must
18-
call mainthread.Init from the main package. For example:
18+
call `mainthread.Init` from the main package. For example:
1919

2020
```go
2121
package main
@@ -26,18 +26,20 @@ func main() { mainthread.Init(fn) }
2626

2727
// fn is the actual main function
2828
func fn() {
29-
// mainthread.Call returns when f1 returns. Note that if f1 blocks
30-
// it will also block the execution of any subsequent calls on the
31-
// main thread.
32-
mainthread.Call(f1)
29+
// ... do whatever you want to do ...
3330

34-
// ... do whatever you want to do ...
31+
// mainthread.Call returns when f1 returns. Note that if f1 blocks
32+
// it will also block the execution of any subsequent calls on the
33+
// main thread.
34+
mainthread.Call(f1)
3535

36-
// mainthread.Go returns immediately and f2 is scheduled to be executed
37-
// in the future.
38-
mainthread.Go(f2)
36+
// ... do whatever you want to do ...
3937

40-
// ... do whatever you want to do ...
38+
// mainthread.Go returns immediately and f2 is scheduled to be
39+
// executed in the future.
40+
mainthread.Go(f2)
41+
42+
// ... do whatever you want to do ...
4143
}
4244

4345
func f1() { ... }

mainthread.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// Package mainthread offers facilities to schedule functions
88
// on the main thread. To use this package properly, one must
9-
// call mainthread.Init from the main package. For example:
9+
// call `mainthread.Init` from the main package. For example:
1010
//
1111
// package main
1212
//
@@ -16,6 +16,8 @@
1616
//
1717
// // fn is the actual main function
1818
// func fn() {
19+
// // ... do whatever you want to do ...
20+
//
1921
// // mainthread.Call returns when f1 returns. Note that if f1
2022
// // blocks it will also block the execution of any subsequent
2123
// // calls on the main thread.

0 commit comments

Comments
 (0)