diff options
author | Christopher Baines <mail@cbaines.net> | 2025-01-08 15:57:30 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2025-01-09 09:34:11 +0000 |
commit | dcb56ee2c5ac3e283cb46841766e7282f3c2c52e (patch) | |
tree | be7c5e15580604ca9cd3d3ac19195e430c8b1507 /tests | |
parent | 59c183b13fc10e0d3c0b682d1db7eec4ae24659f (diff) | |
download | knots-dcb56ee2c5ac3e283cb46841766e7282f3c2c52e.tar knots-dcb56ee2c5ac3e283cb46841766e7282f3c2c52e.tar.gz |
Tweak the resource pool
Mostly to no longer sleep in the main fiber. Now the main fiber just
spawns other fibers when it would previously block on put-operation
and these other fibers communicate back to the main resource pool
fiber when necessary.
This should mean that the resource pool is more responsive.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/resource-pool.scm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/resource-pool.scm b/tests/resource-pool.scm index b6db98f..33f5a0c 100644 --- a/tests/resource-pool.scm +++ b/tests/resource-pool.scm @@ -15,6 +15,19 @@ res) 2)))) +(run-fibers-for-tests + (lambda () + (let ((resource-pool (make-resource-pool + (lambda () + 2) + 1 + #:add-resources-parallelism 1))) + (assert-equal + (with-resource-from-pool resource-pool + res + res) + 2)))) + (let* ((error-constructor (record-constructor &resource-pool-timeout)) (err |