Add another resource pool test
This commit is contained in:
parent
9c123bbfa9
commit
05f7daf0e9
1 changed files with 30 additions and 0 deletions
|
|
@ -252,4 +252,34 @@
|
|||
|
||||
(destroy-resource-pool resource-pool))))
|
||||
|
||||
;; Test allocating resources to waiters and destroying resources
|
||||
(run-fibers-for-tests
|
||||
(lambda ()
|
||||
(let ((resource-pool (make-resource-pool
|
||||
(lambda ()
|
||||
(sleep 1)
|
||||
'res)
|
||||
2
|
||||
#:idle-seconds 1
|
||||
#:add-resources-parallelism 10
|
||||
#:destructor
|
||||
(const #t))))
|
||||
(fibers-for-each
|
||||
(lambda _
|
||||
(with-resource-from-pool resource-pool
|
||||
res
|
||||
res))
|
||||
(iota 20))
|
||||
|
||||
(sleep 2)
|
||||
|
||||
(fibers-for-each
|
||||
(lambda _
|
||||
(with-resource-from-pool resource-pool
|
||||
res
|
||||
res))
|
||||
(iota 20))
|
||||
|
||||
(destroy-resource-pool resource-pool))))
|
||||
|
||||
(display "resource-pool test finished successfully\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue