From dcb56ee2c5ac3e283cb46841766e7282f3c2c52e Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 8 Jan 2025 15:57:30 +0000 Subject: 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. --- tests/resource-pool.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') 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 -- cgit v1.2.3