From 87d85a3425bb22b8792d8629f3a70cfd7577ba5c Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Wed, 14 Feb 2024 22:12:01 -0700 Subject: [PATCH] docs --- src/apatheia/jobs.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/apatheia/jobs.nim b/src/apatheia/jobs.nim index fb81463..d4a1898 100644 --- a/src/apatheia/jobs.nim +++ b/src/apatheia/jobs.nim @@ -54,6 +54,7 @@ proc processJobs*[T](jobs: JobQueue[T]) {.async.} = info "Finishing processing jobs for type ", type=tn proc createFuture*[T](jobs: JobQueue[T], name: static string): (JobResult[T], Future[T]) = + ## Creates a future that returns the result of the associated job. let fut = newFuture[T](name) let id = JobId fut.id() jobs.futures[id] = fut @@ -61,6 +62,7 @@ proc createFuture*[T](jobs: JobQueue[T], name: static string): (JobResult[T], Fu return (JobResult[T](id: id, queue: jobs.queue), fut, ) proc newJobQueue*[T](maxItems: int = 0, taskpool: Taskpool = Taskpool.new()): JobQueue[T] {.raises: [ApatheiaSignalErr].} = + ## Creates a new async-compatible threaded job queue. result = JobQueue[T](queue: newSignalQueue[(uint, T)](maxItems), taskpool: taskpool, running: true) asyncSpawn(processJobs(result))