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

Re: [plt-scheme] Call/cc problem



>In MzScheme, continuations may only be invoked by the same thread that
>created them.  That's probably why you received the error message
>   "continuation application: attempted to  cross a continuation boundary".
>There are a few other places that set continuation boundaries, too, though.
>
>Why can't A block on a semaphore until it receives an response from B?

Sorry, there was a similar reply on Usenet (posting to 
comp.lang.scheme finally worked).

My post was misleading: A and B are different *operating system 
processes* or in other words different end-user applications. B is 
not written in MzScheme.

B talks to A like if a user was typing into MzScheme (A) running in 
an interactive shell. It's a nasty hack... and it just doesn't work 
because I've made some error, I guess.

Perhaps the code does help. It probably contains a stupid and 
extremely obvious error:

(define (send/sync-command command)
   (call/cc
    (lambda (cc)
      (send wp:Continuation-Table
            store-command-continuation!
            command cc)
       (send-command command)
      #t))
   (display "Send/sync body")(newline))

(define (global-command-handler data)
   (let* ((command (make-icmd data))
          (continue (send wp:Continuation-Table
                   handle-command
                   command)))
     (if continue (continue command)
         (begin
           (print (icmd-data command))
           (newline)))))


wp:Continuation-Table% is a class that currently is just a wrapper to 
a hash-table. Handle-command returns the continuation, or #f if its 
argument is not a reply to a previous command.

Any ideas?

Regards,

Erich

P.S. Btw, DrScheme 200alpha21 OSX/Quartz pastes code without carriage 
returns-- sorry to Paul whom I sent this mess in a private reply!