[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/07: workers: Add test with exceptions.
From: |
Ludovic Courtès |
Subject: |
02/07: workers: Add test with exceptions. |
Date: |
Fri, 17 Nov 2017 05:09:42 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 19fd7229bc668e5b34adc5357557aff3f62b9308
Author: Ludovic Courtès <address@hidden>
Date: Fri Nov 17 10:47:11 2017 +0100
workers: Add test with exceptions.
* tests/workers.scm ("exceptions"): New test.
---
tests/workers.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tests/workers.scm b/tests/workers.scm
index 44b882f..4eaefbb 100644
--- a/tests/workers.scm
+++ b/tests/workers.scm
@@ -42,4 +42,30 @@
(poll)))
result))
+;; Same as above, but throw exceptions within the workers and make sure they
+;; remain alive.
+(test-equal "exceptions"
+ 4242
+ (let* ((pool (make-pool 10))
+ (result 0)
+ (1+! (let ((lock (make-mutex)))
+ (lambda ()
+ (with-mutex lock
+ (set! result (+ result 1)))))))
+ (let loop ((i 10))
+ (unless (zero? i)
+ (pool-enqueue! pool (lambda ()
+ (throw 'whatever)))
+ (loop (- i 1))))
+ (let loop ((i 4242))
+ (unless (zero? i)
+ (pool-enqueue! pool 1+!)
+ (loop (- i 1))))
+ (let poll ()
+ (unless (pool-idle? pool)
+ (pk 'busy result)
+ (sleep 1)
+ (poll)))
+ result))
+
(test-end)
- branch master updated (ef2c6b4 -> 9bc646d), Ludovic Courtès, 2017/11/17
- 01/07: workers: 'pool-idle?' returns true only if the workers are idle., Ludovic Courtès, 2017/11/17
- 03/07: workers: Display backtrace in pre-unwind handler., Ludovic Courtès, 2017/11/17
- 02/07: workers: Add test with exceptions.,
Ludovic Courtès <=
- 06/07: gnu: gnome-disk-utility: Update to 3.26.2., Ludovic Courtès, 2017/11/17
- 04/07: gnu: libnftnl: Update to 1.0.8., Ludovic Courtès, 2017/11/17
- 07/07: gnu: eog: Update to 3.26.2., Ludovic Courtès, 2017/11/17
- 05/07: gnu: nftables: Update to 0.8., Ludovic Courtès, 2017/11/17