<div dir="ltr">I think the main missing thing is that the thread you're requiriing the user's program on should be under the control of the custodian. In other words, you'll want to create a new eventspace (under the new custodian) and queue a callback over to it to require the user's program.<div>
<br></div><div>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 3, 2014 at 4:26 PM, Greg Hendershott <span dir="ltr"><<a href="mailto:greghendershott@gmail.com" target="_blank">greghendershott@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So the background for Spencer's question was a problem with my Emacs<br>
racket-mode when using racket/gui/base.<br>
<br>
There's a long-ish bug report comment thread. If you want to read it,<br>
at all, you might want to skip to the last few comments, here:<br>
<br>
<a href="https://github.com/greghendershott/racket-mode/issues/26#issuecomment-39494285" target="_blank">https://github.com/greghendershott/racket-mode/issues/26#issuecomment-39494285</a><br>
<br>
Or the TL;DR: I probably don't need racket/sandbox at all. I probably<br>
just need a new namespace and a custodian -- in order to do a<br>
DrRacket-style "reset the REPL to the source file".<br>
<br>
Matthew and Robby I know you're both incredibly busy, but if either of<br>
you had a chance to look at this code, I'd be grateful. Although part<br>
of me hopes you'll say "perfect!", the older/wiser part of me hopes<br>
you'll point out X Y and Z problems I don't yet realize I have. It's<br>
just these 30 lines of code here:<br>
<br>
<a href="https://github.com/greghendershott/racket-mode/blob/experimental/sandbox.rkt#L30-L66" target="_blank">https://github.com/greghendershott/racket-mode/blob/experimental/sandbox.rkt#L30-L66</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Sun, Mar 23, 2014 at 8:35 PM, Robby Findler<br>
<<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>> wrote:<br>
> It is safe, however, to share the racket/gui/base that you get with the one<br>
> in the sandbox.<br>
><br>
> Robby<br>
><br>
><br>
> On Sun, Mar 23, 2014 at 7:25 PM, Matthew Flatt <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br>
>><br>
>> Yes, this is a limitation of `racket/gui/base`. On initialization, the<br>
>> library must register in various non-composable ways with an underlying<br>
>> GUI toolkit (callbacks, Objective-C classes, Win32 classes, etc.), and<br>
>> so `racket/gui/base` cannot be instantiated multiple times.<br>
>><br>
>> At Sun, 23 Mar 2014 20:12:43 -0400, Spencer Florence wrote:<br>
>> > I'm attempting to launch multiple evaluators which require `racket/gui`,<br>
>> > however I get the error:<br>
>> ><br>
>> > cannot instantiate `racket/gui/base` a second time in the same process<br>
>> ><br>
>> > Is `racket/gui/base` maintaining some kind of state thats escaping the<br>
>> > sandbox?<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > Example of the problem:<br>
>> ><br>
>> > #lang racket/base<br>
>> > (require racket/sandbox)<br>
>> ><br>
>> > (call-with-trusted-sandbox-configuration<br>
>> > (lambda ()<br>
>> > (define (make)<br>
>> > (make-evaluator 'racket/base<br>
>> > #:requires '(racket/gui/base)))<br>
>> ><br>
>> > (make)<br>
>> > (make)))<br>
>> > ____________________<br>
>> > Racket Users list:<br>
>> > <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
>> ____________________<br>
>> Racket Users list:<br>
>> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
><br>
><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
</div></div></blockquote></div><br></div>