No description
Find a file
2023-03-15 19:02:06 +00:00
src Add warning for using refc 2023-03-15 19:02:06 +00:00
tests Bump version 2023-03-15 17:05:11 +00:00
.gitignore Bind all API 2023-03-15 16:50:29 +00:00
minicoro.nimble Fix nim frame 2023-03-15 18:53:36 +00:00
readme.md Add warning for using refc 2023-03-15 19:02:06 +00:00

Coroutine in Nim, courtesy of https://github.com/edubart/minicoro

Warning: minicoro is not tested without --mm:orc or --mm:arc

Usage

import minicoro

proc coro_entry(co: Coro) {.cdecl.} =
  var data: int
  co.pop(data)
  echo data # print 42

  co.yield


var desc = initCoroDesc(coro_entry, 0)
let co = desc.create()

co.push(42.int) # each corotine has its own storage stack

assert co.status == coSUSPENDED
co.resume
assert co.status == coSUSPENDED
co.resume
assert co.status == coDEAD

co.destroy()

For another example, see this test file For complete API, see source code