[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #989: High CPU usage when calling signal handler
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #989: High CPU usage when calling signal handler multiple times |
Date: |
Sun, 06 Oct 2013 19:11:23 -0000 |
#989: High CPU usage when calling signal handler multiple times
-----------------------------+----------------------------------------------
Reporter: mario | Owner:
Type: defect | Status: new
Priority: critical | Milestone: 4.9.0
Component: core libraries | Version: 4.8.x
Resolution: | Keywords: signal handling
-----------------------------+----------------------------------------------
Comment(by sjamaan):
Still unclear, but the continuation of sleep seems to be doing something
very strange. If we explicitly capture the continuation (which should be
identical to the implicit continuation) and pass it to the procedure when
we invoke it, it works. If we use the continuation supplied by the
foreign-lambda wrapper, it breaks.
However, if sleep(x) is replaced by a constant integer, it works with
either continuation.
{{{
#!scm
(use posix)
;; BROKEN:
(define do-sleep
(foreign-primitive ((scheme-object k) (int x))
"printf(\"%d\\n\", sleep(x)); C_values(2,
C_SCHEME_UNDEFINED, C_k);"))
;; OKAY:
(define do-sleep
(foreign-primitive ((scheme-object k) (int x))
"printf(\"%d\\n\", sleep(x)); C_values(2,
C_SCHEME_UNDEFINED, k);"))
(set-signal-handler!
signal/int
(lambda (signal)
(print "caught signal" signal)
(call/cc (lambda (k) (do-sleep k 10)))))
(let loop ()
(sleep 1)
(loop))
}}}
It gets weirder and weirder!
--
Ticket URL: <http://bugs.call-cc.org/ticket/989#comment:6>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.
- Re: [Chicken-janitors] #989: High CPU usage when calling signal handler multiple times,
Chicken Trac <=