chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1067: Variable set! in signal handler is optimised a


From: Chicken Trac
Subject: [Chicken-janitors] #1067: Variable set! in signal handler is optimised away in other code.
Date: Tue, 19 Nov 2013 17:20:26 -0000

#1067: Variable set! in signal handler is optimised away in other code.
---------------------+------------------------------------------------------
 Reporter:  andyjpb  |       Owner:         
     Type:  defect   |      Status:  new    
 Priority:  major    |   Milestone:  someday
Component:  unknown  |     Version:  4.8.x  
 Keywords:           |  
---------------------+------------------------------------------------------
 In a module I have

 {{{
 (define keep-going "yes") ; #t seems to cause the (if keep-going ...)
 check to get optimised away.

 ...

 (define (shutdown #!optional signum)
  (debug! "Proclaim got signal ~A: shutting down..." signum)
  (set! keep-going #f))

 (define (handler)
   (set-signal-handler! signal/term shutdown)

 ...

 (if keep-going
   (begin
     ...
     (loop)))

 ...
 )
 }}}


 In my main program I (use ...) my module and then call handler which loops
 "forever".

 As per the comment, if I use #t for the sentinel value of keep-going then
 the signal handler is unable to set! it to #f so the loop is never broken.
 If I use "yes" then it seems to work as expected.

 I can't use a parameter because I don't know which thread the signal will
 be received in and the loop runs in the primordial thread.

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/1067>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]