@Zoom Thanks. I now am using "parallel". Now it works. The return values of a
function in a thread can now be saved. Just an example how to use it:
{.experimental: "parallel".}
import httpclient, threadpool
proc fetch(url: string): string =
return getContent(url)
let urls = ["https://example.com", "https://example.org",
"https://example.net"]
var res = newSeq[string]()
var tasks = newSeq[FlowVar[string]](urls.len)
parallel:
for i in 0 ..< urls.len:
tasks[i] = spawn fetch(urls[i])
for task in tasks:
res.add(^task)
echo res
Run