chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] are standard bindings write protected?


From: felix
Subject: Re: [Chicken-users] are standard bindings write protected?
Date: Sun, 23 Nov 2003 00:12:11 +0100
User-agent: Opera7.11/Linux M2 build 406

On 22 Nov 2003 16:49:43 +0100, Joerg F. Wittenberger <address@hidden> wrote:

Hi Felix,

It appears to be actually worse than just that.  The code, compiled in
module A modifies the globals, code in the module B (depending on A),
uses it, but gets the original definition instead my modified one.

I also see some suspicious messages relating to other definitions I
wrote over.  Like here:

Warning: global variable `abort' is never used
Warning: global variable `signal' is never used
Warning: global variable `##sys#error' is never used

You are probably compiling in block-mode, or using
the `export' declaration, without exporting the variables mentioned
above.


`force' is not among them, but it's also used within A, which should
be reason enpugh.

The interpreter in contrast uses the modified force, but then goes
into an endless loop within 'UnlockedWait below.  This seems a srfi-18
problem, isn't it?


;;** future

(define-record-type <future>
(internal-make-future mutex condition has-result result)
future?
(mutex future-mutex)
(condition future-condition)
(has-result future-has-result future-has-result-set!)
(result future-result future-result-set!))



(define (logerr . args)
(apply format (current-error-port) args)
(flush-output (current-error-port)))

(define (debug lbl x) (logerr " D ~a: ~s\n" lbl x) x)

(define (future-force f)
(if (debug 'HasResult (future-has-result f))
(future-result f)
(begin
(debug 'GotLock (mutex-lock! (future-mutex f)))
(if (debug 'HasNow (future-has-result f))
(begin
(debug 'Unlocked (mutex-unlock! (future-mutex f)))
(future-result f))
(begin
(debug 'UnlockedWait (mutex-unlock! (future-mutex f) (future-condition f))

)
(future-result f))))))

(define (make-future thunk name)
(let ((f (internal-make-future (make-mutex)
(make-condition-variable)
#f 'invalid)))
(thread-start!
(make-thread
(lambda ()
(future-result-set! f (with-exception-guard identity thunk))
                                       ^^^^^
                                       handler

(the error doesn't get shown, the thread terminates, but since
there is no join, the exception doesn't get signalled.


cheers,
felix





reply via email to

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