mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
More robust asyncs.test
* test-suite/tests/asyncs.test: Instead of wrapping abort-to-prompt with false-if-exception, to handle edge cases, guard with suspendable-continuation?: this also catches recursive invocations.
This commit is contained in:
parent
1ad31adf30
commit
850b724f85
1 changed files with 19 additions and 21 deletions
|
@ -82,11 +82,10 @@
|
|||
(with-sigprof-interrupts
|
||||
1000 ; Hz
|
||||
(lambda ()
|
||||
;; Could throw an exception if the prompt is
|
||||
;; not active (i.e. interrupt happens
|
||||
;; outside running a cothread). Ignore in
|
||||
;; that case.
|
||||
(false-if-exception (abort-to-prompt preempt-tag)))
|
||||
;; Interrupt could fire outside running a cothread, or
|
||||
;; recursively within an async; ignore in that case.
|
||||
(when (suspendable-continuation? preempt-tag)
|
||||
(abort-to-prompt preempt-tag)))
|
||||
run-cothreads)
|
||||
(equal? (atomic-box-ref box) 100))))
|
||||
|
||||
|
@ -118,19 +117,18 @@
|
|||
(atomic-box-set! box (1+ x)))
|
||||
(lp))))))
|
||||
(let* ((main-thread (current-thread))
|
||||
(preempt-thread (call-with-new-thread
|
||||
(preempt-thread
|
||||
(call-with-new-thread
|
||||
(lambda ()
|
||||
(let lp ()
|
||||
(unless (= (atomic-box-ref box) 100)
|
||||
(usleep 1000)
|
||||
(system-async-mark
|
||||
(lambda ()
|
||||
;; Could throw an exception if the
|
||||
;; prompt is not active
|
||||
;; (i.e. interrupt happens outside
|
||||
;; running a cothread). Ignore in
|
||||
;; that case.
|
||||
(false-if-exception
|
||||
;; Interrupt could fire outside running a
|
||||
;; cothread, or recursively within an async;
|
||||
;; ignore in that case.
|
||||
(when (suspendable-continuation? preempt-tag)
|
||||
(abort-to-prompt preempt-tag)))
|
||||
main-thread)
|
||||
(lp)))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue