Add :idx: for suspend in coro module.
This commit is contained in:
parent
fa99a60222
commit
c60728326e
1 changed files with 2 additions and 0 deletions
|
|
@ -50,6 +50,8 @@ proc start*(c: proc(), stacksize: int=defaultStackSize) =
|
||||||
proc suspend*(sleepTime: float=0) =
|
proc suspend*(sleepTime: float=0) =
|
||||||
## Stops coroutine execution and resumes no sooner than after ``sleeptime`` seconds.
|
## Stops coroutine execution and resumes no sooner than after ``sleeptime`` seconds.
|
||||||
## Until then other coroutines are executed.
|
## Until then other coroutines are executed.
|
||||||
|
##
|
||||||
|
## This is similar to a `yield`:idx:, or a `yieldFrom`:idx in Python.
|
||||||
var oldFrame = getFrame()
|
var oldFrame = getFrame()
|
||||||
var sp {.volatile.}: pointer
|
var sp {.volatile.}: pointer
|
||||||
GC_setCurrentStack(current.stack, cast[pointer](addr sp))
|
GC_setCurrentStack(current.stack, cast[pointer](addr sp))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue