cisco / ChezScheme

Chez Scheme
Apache License 2.0
6.98k stars 986 forks source link

make error when build SWL #432

Open guenchi opened 5 years ago

guenchi commented 5 years ago

when build chez scheme's gui tools, I get a problem:

Exception: multiple definitions for with-mutex in body (lambda () #<annotation init.ss[15404:15451] (define (...) #t)> #<annotation init.ss[15455:15474] (import swl:macros)> #<annotation init.ss[15477:15493] (import $system)> #<annotation init.ss[15496:15554] (define \x2B;fixnum? (...))> ...) at line 341, char 1 of init.ss

io.ss

(define-syntax with-mutex
  (syntax-rules ()
    ((_ mutex e0 e1 ...)
     (let ((m mutex))
       (dynamic-wind 
        (lambda () (mutex-acquire m))
        (lambda () e0 e1 ...)
        (lambda () (mutex-release m)))))))

syntax.ss

(define-syntax with-mutex
  (syntax-rules ()
    [(with-mutex sem e0 e1 ...)
     (let ([s sem])
       (send s wait)
       ((let ([thunk
               (guard (c [#t (lambda () (#%raise c))])
                 (call-with-values
                   (lambda () e0 e1 ...)
                   (case-lambda
                     [(arg) (lambda () arg)]
                     [args (lambda () (apply values args))])))])
          (send s signal)
          thunk)))]))

thx

gwatt commented 5 years ago

You can't build SWL with the threaded version of Chez.

guenchi commented 5 years ago

You can't build SWL with the threaded version of Chez.

thx.

and... why?

gwatt commented 5 years ago

SWL provides its own notion of threading, and as you can see, some of the identifiers conflict with those provided by the threaded versions of Chez Scheme. I did try at one point to use the Chez Scheme threading with SWL by removing the SWL code, but it deadlocked immediately upon starting.