removed coro deprecations
This commit is contained in:
parent
7d9a748fcd
commit
d876960b9d
1 changed files with 0 additions and 6 deletions
|
|
@ -17,7 +17,6 @@ import lists
|
||||||
|
|
||||||
const defaultStackSize = 512 * 1024
|
const defaultStackSize = 512 * 1024
|
||||||
|
|
||||||
|
|
||||||
type Coroutine = ref object
|
type Coroutine = ref object
|
||||||
# prev: ptr Coroutine
|
# prev: ptr Coroutine
|
||||||
# next: ptr Coroutine
|
# next: ptr Coroutine
|
||||||
|
|
@ -46,7 +45,6 @@ proc start*(c: proc(), stacksize: int=defaultStackSize) =
|
||||||
coro.stack = alloc0(stacksize)
|
coro.stack = alloc0(stacksize)
|
||||||
coro.stacksize = stacksize
|
coro.stacksize = stacksize
|
||||||
coroutines.append(coro)
|
coroutines.append(coro)
|
||||||
{.deprecated: [coroStart: start].}
|
|
||||||
|
|
||||||
{.push stackTrace: off.}
|
{.push stackTrace: off.}
|
||||||
proc sleep*(sleepTime: float=0) =
|
proc sleep*(sleepTime: float=0) =
|
||||||
|
|
@ -61,7 +59,6 @@ proc sleep*(sleepTime: float=0) =
|
||||||
longjmp(mainCtx, 1)
|
longjmp(mainCtx, 1)
|
||||||
setFrame(oldFrame)
|
setFrame(oldFrame)
|
||||||
{.pop.}
|
{.pop.}
|
||||||
{.deprecated: [coroYield: sleep].}
|
|
||||||
|
|
||||||
proc run*() =
|
proc run*() =
|
||||||
## Starts main event loop which exits when all coroutines exit. Calling this proc
|
## Starts main event loop which exits when all coroutines exit. Calling this proc
|
||||||
|
|
@ -108,20 +105,17 @@ proc run*() =
|
||||||
node = coroutines.head
|
node = coroutines.head
|
||||||
else:
|
else:
|
||||||
node = node.next
|
node = node.next
|
||||||
{.deprecated: [coroRun: run].}
|
|
||||||
|
|
||||||
proc alive*(c: proc()): bool =
|
proc alive*(c: proc()): bool =
|
||||||
## Returns ``true`` if coroutine has not returned, ``false`` otherwise.
|
## Returns ``true`` if coroutine has not returned, ``false`` otherwise.
|
||||||
for coro in items(coroutines):
|
for coro in items(coroutines):
|
||||||
if coro.fn == c:
|
if coro.fn == c:
|
||||||
return true
|
return true
|
||||||
{.deprecated: [coroAlive: alive].}
|
|
||||||
|
|
||||||
proc wait*(c: proc(), interval=0.01) =
|
proc wait*(c: proc(), interval=0.01) =
|
||||||
## Returns only after coroutine ``c`` has returned. ``interval`` is time in seconds how often.
|
## Returns only after coroutine ``c`` has returned. ``interval`` is time in seconds how often.
|
||||||
while alive(c):
|
while alive(c):
|
||||||
sleep interval
|
sleep interval
|
||||||
{.deprecated: [coroWait: wait].}
|
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
var stackCheckValue = 1100220033
|
var stackCheckValue = 1100220033
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue