mirror of
https://github.com/bloeys/cogo.git
synced 2025-12-29 08:58:19 +00:00
Comments
This commit is contained in:
2
demo.go
2
demo.go
@ -33,8 +33,10 @@ func test(c *cogo.Coroutine[int, int]) {
|
|||||||
println("test yield:", 1)
|
println("test yield:", 1)
|
||||||
c.Yield(1)
|
c.Yield(1)
|
||||||
|
|
||||||
|
// Yield here until at least 100ms passed
|
||||||
c.YieldTo(cogo.NewSleeper(100 * time.Millisecond))
|
c.YieldTo(cogo.NewSleeper(100 * time.Millisecond))
|
||||||
|
|
||||||
|
// Yield here until the coroutine 'test2' has finished
|
||||||
c.YieldTo(cogo.New(test2, 0))
|
c.YieldTo(cogo.New(test2, 0))
|
||||||
|
|
||||||
println("test yield:", 2)
|
println("test yield:", 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user