Initial commit
This commit is contained in:
commit
2f39c58d6c
27 changed files with 2969 additions and 0 deletions
32
tests/worker-threads.scm
Normal file
32
tests/worker-threads.scm
Normal file
|
@ -0,0 +1,32 @@
|
|||
(use-modules (tests)
|
||||
(srfi srfi-71)
|
||||
(fibers)
|
||||
(unit-test)
|
||||
(knots worker-threads))
|
||||
|
||||
(let ((worker-thread-channel
|
||||
(make-worker-thread-channel
|
||||
(const '())
|
||||
#:parallelism 2)))
|
||||
|
||||
(run-fibers-for-tests
|
||||
(lambda ()
|
||||
(assert-equal
|
||||
(call-with-worker-thread
|
||||
worker-thread-channel
|
||||
(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")
|
Loading…
Add table
Add a link
Reference in a new issue