guile-knots/tests/worker-threads.scm

33 lines
625 B
Scheme
Raw Normal View History

2024-11-19 18:43:43 +00:00
(use-modules (tests)
(srfi srfi-71)
(fibers)
(unit-test)
(knots worker-threads))
(let ((worker-thread-set
(make-worker-thread-set
2024-11-19 18:43:43 +00:00
(const '())
#:parallelism 2)))
(run-fibers-for-tests
(lambda ()
(assert-equal
(call-with-worker-thread
worker-thread-set
2024-11-19 18:43:43 +00:00
(lambda ()
4))
4))))
(let ((process-job
count-jobs
count-threads
list-jobs
(create-work-queue
2
(lambda (i)
(* i 2)))))
(process-job 3))
(display "worker-threads test finished successfully\n")