chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] strange behavior - any reason?


From: Joerg F. Wittenberger
Subject: [Chicken-users] strange behavior - any reason?
Date: 16 Dec 2002 16:08:24 +0100

Hi all,

I noticed some very strange behavior, which apparently combines two
hardly interpreted aspects a) something about the condition handling
at least differs from what I'd expect b) the threading system seems
strange...

I tried to disassemble a condition I caught like this


(define (condition->fields ex)
  (cond
    ((exn? ex)
     (values "exception" (exn-message ex) (exn-arguments ex) '()))
    ((uncaught-exception? ex)

     (let loop ((reason (uncaught-exception-reason ex))
                (n 0))

       (cond
        ((exn? reason)
           (values "uncaught exception"
                   (exn-message reason) (exn-arguments reason) '()))


        ((uncaught-exception? reason)
         (loop (uncaught-exception-reason ex) (add1 n)))

>From the chicken source I'd expect this loop to terminate soon.  But
this loops endlessly.


        (else (values "uncaught exception" (format #f "N ~a: >>~s<<" n reason) 
'() '())))))
    ((join-timeout-exception? ex)
     (values "time out" "join-timeout-exception") '() '())
    (else (values "unknown exception" (format #f "~s" ex) '() '()))))

So how do I find out where this uncaught exception comes from?

As to the threading question: when the code runs into the above
endless loop, the system load is almost zero on my single processor
machine.  This loop eats about 2.5% processor time and that's it.
(Only if I print the value of 'n' in every loop, I get a reasonable
load.)  So what does the executable do instead of processing my stupid
endless loop?  Does chicken have some smart optimization to conserve
cpu load for usless operations?  ;-)

regards

/Jörg

-- 
The worst of harm may often result from the best of intentions.



reply via email to

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