[Top][All Lists]

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

Re: [MIT-Scheme-devel] multi-threading problem: Unassigned variable: roo

From: Micah Brodsky
Subject: Re: [MIT-Scheme-devel] multi-threading problem: Unassigned variable: root-continuation-default
Date: Thu, 26 Apr 2012 11:10:47 -0400

For your thread to have a sensible dynamic extent to run in, you probably
want to do something like

  (lambda (k)
    (create-thread k thunk)))

Or, you might use with-create-thread-continuation to fluid-let a default. I
think what's happening is you have a simple default root continuation that,
within it, doesn't have a default root continuation set.

While you're at it, do be careful about using sockets from multiple threads
simultaneously. They're not really thread-safe like native OS sockets are.
I've been bitten badly by this and have taken to treating them as purely
thread-local objects. (Other people can explain the details of what you can
and can't get away with better than I can.)

(Incidentally... I have on occasion tried to punt a computation from one
thread into the dynamic extent of a continuation from another thread using
within-continuation, making sure to call back to the original continuation
when the computation finishes. While this works fine when all continuations
are from the same thread, the same code seems to leave the target thread
orphaned in some way, never to return, when the continuations come from
different threads. Does anyone know, is this a Bad thing to be doing?)


-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf
Of address@hidden
Sent: Thursday, April 26, 2012 8:29 AM
To: address@hidden
Subject: [MIT-Scheme-devel] multi-threading problem: Unassigned variable:

Hello fellow Schemers!

I've been playing around with multiple threads in GNU/MIT-Scheme. I've tried
the following code:

(let ((socket (open-tcp-server-socket 54321)))
  (create-thread #f (lambda ()
                       (let ((sock (tcp-server-connection-accept socket #t
                         (create-thread #f (lambda ()
                                              (format #t "ok~%")
                                              (close-port sock)))))))

then I try to connect to port 54321 locally (with "nc localhost 54321"
for example), which produces the following output:

;Value 13: #[thread 13]

1 ]=>
;The thread #[thread 13] signalled an error: Unassigned variable:
root-continuation-default ;To continue, call RESTART with an option number:
; (RESTART 3) => Specify a value to use instead of
; (RESTART 2) => Set root-continuation-default to a given value.
; (RESTART 1) => Return to read-eval-print level 1.

2 error> 

My system is 64 bit Arch Linux, the GNU/MIT-Scheme version is Release 9.1.1
|| Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 4.118 || Edwin

I'd be glad about any help you might provide in getting this fixed, I'm
trying to get a server running in the background while I can still update
definitions and whatnot in the foreground.

Thanks for all the hard work on GNU/MIT-Scheme!


MIT-Scheme-devel mailing list

reply via email to

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