Skip to content

Commit

Permalink
Modify readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
timandy committed Jul 21, 2022
1 parent fba1e8f commit 2e6bf0f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -141,17 +141,17 @@ Creates a new `ThreadLocal` instance with a stored default value of `nil`. When

Creates a new `ThreadLocal` instance with stored default values generated by calling `supplier()`. When a new coroutine is started via `Go()`, `GoWait()` or `GoWaitResult()`, the value of the current coroutine is copied to the new coroutine.

## `Go(fun func())`
## `Go(fun Runnable)`

Start a new coroutine and automatically copy all contextual `inheritableThreadLocals` data of the current coroutine to the new coroutine. Any `panic` while the child coroutine is executing will be caught and the stack automatically printed.

## `GoWait(fun func()) Future`
## `GoWait(fun CancelRunnable) Future`

Start a new coroutine and automatically copy all contextual `inheritableThreadLocals` data of the current coroutine to the new coroutine. You can wait for the sub-coroutine to finish executing through the `Future.Get()` method that returns a value. Any `panic` while the child coroutine is executing will be caught and thrown again when `Future.Get()` is called.
Start a new coroutine and automatically copy all contextual `inheritableThreadLocals` data of the current coroutine to the new coroutine. You can wait for the sub-coroutine to finish executing through the `Future.Get()` or `Future.GetWithTimeout()` method that returns a value. Any `panic` while the child coroutine is executing will be caught and thrown again when `Future.Get()` or `Future.GetWithTimeout()` is called.

## `GoWaitResult(fun func() Any) Future`
## `GoWaitResult(fun CancelCallable) Future`

Start a new coroutine and automatically copy all contextual `inheritableThreadLocals` data of the current coroutine to the new coroutine. You can wait for the sub-coroutine to finish executing and get the return value through the `Future.Get()` method of the return value. Any `panic` while the child coroutine is executing will be caught and thrown again when `Future.Get()` is called.
Start a new coroutine and automatically copy all contextual `inheritableThreadLocals` data of the current coroutine to the new coroutine. You can wait for the sub-coroutine to finish executing and get the return value through the `Future.Get()` or `Future.GetWithTimeout()` method of the return value. Any `panic` while the child coroutine is executing will be caught and thrown again when `Future.Get()` or `Future.GetWithTimeout()` is called.

[More API Documentation](https://pkg.go.dev/github.com/timandy/routine#section-documentation)

Expand Down
10 changes: 5 additions & 5 deletions README_zh.md
Expand Up @@ -141,17 +141,17 @@ inheritableThreadLocal in goroutine by Go: Hello world2

创建一个新的`ThreadLocal`实例,其存储的默认值会通过调用`supplier()`生成。当通过`Go()``GoWait()``GoWaitResult()`启动新协程时,当前协程的值会被复制到新协程。

## `Go(fun func())`
## `Go(fun Runnable)`

启动一个新的协程,同时自动将当前协程的全部上下文`inheritableThreadLocals`数据复制至新协程。子协程执行时的任何`panic`都会被捕获并自动打印堆栈。

## `GoWait(fun func()) Future`
## `GoWait(fun CancelRunnable) Future`

启动一个新的协程,同时自动将当前协程的全部上下文`inheritableThreadLocals`数据复制至新协程。可以通过返回值的`Future.Get()`方法等待子协程执行完毕。子协程执行时的任何`panic`都会被捕获并在调用`Future.Get()`时再次抛出。
启动一个新的协程,同时自动将当前协程的全部上下文`inheritableThreadLocals`数据复制至新协程。可以通过返回值的`Future.Get()``Future.GetWithTimeout()`方法等待子协程执行完毕。子协程执行时的任何`panic`都会被捕获并在调用`Future.Get()``Future.GetWithTimeout()`时再次抛出。

## `GoWaitResult(fun func() Any) Future`
## `GoWaitResult(fun CancelCallable) Future`

启动一个新的协程,同时自动将当前协程的全部上下文`inheritableThreadLocals`数据复制至新协程。可以通过返回值的`Future.Get()`方法等待子协程执行完毕并获取返回值。子协程执行时的任何`panic`都会被捕获并在调用`Future.Get()`时再次抛出。
启动一个新的协程,同时自动将当前协程的全部上下文`inheritableThreadLocals`数据复制至新协程。可以通过返回值的`Future.Get()``Future.GetWithTimeout()`方法等待子协程执行完毕并获取返回值。子协程执行时的任何`panic`都会被捕获并在调用`Future.Get()``Future.GetWithTimeout()`时再次抛出。

[更多API文档](https://pkg.go.dev/github.com/timandy/routine#section-documentation)

Expand Down

0 comments on commit 2e6bf0f

Please sign in to comment.