When I run this code,<br><br>xterm 1 & 2 don't show any errors<br>xterm 3 is just _blank_; it doesn't show the gsi prompt; suggestions for what may be wrong?<br><br>Thanks!<br><br><div class="gmail_quote">On Wed, May 20, 2009 at 6:29 AM, Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
On 20-May-09, at 12:03 AM, lowly coder wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Please see typescript (sorry, copy/paste not working in X right now)<br>
<br>
i have test.scm, which forks off a thread (<thread #2>) which forever does:<br>
  (pp 'yay); so I can see it print<br>
  (+ "asdf" 1) ; just to generate an error<br>
<br>
I'm running gsc with -:dar, so i want debugging support, for all threads, and get thrown into a REPL when an error occurs.<br>
<br>
Here are my questions:<br>
<br>
1) in my primordial thread, why do I have to execute some command (like "(void)") before I get thrown into the REPL in thread2? if everything is running concurrently, why does the error in thread2 not pop up immediately and get me thrown into a REPL?<br>

</blockquote>
<br></div>
That's because, by default, the REPL's interaction channel is the console and you have a single console.  So all threads interacting with the user (either REPL or calls to pp) are competing to get control of this single console to do their interaction.  A thread will acquire the console on entry to the REPL and relinquish the console when an expression is evaluated (most comma commands don't relinquish the console).  When the "acquire" operation succeeds and the thread is different from the previous thread that acquired the console, a message is displayed to indicate that the console is servicing the REPL of a different thread.<br>

<br>
The error doesn't immediately pop up because the primordial thread is running a REPL, so it has acquired exclusive access to the console.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
2) in thread 2, after hitting ,(c 0) ... why don' i immediately get an "yay"? (if it's continuing from that error, it should jump back to the (pp 'yay))<br>
</blockquote>
<br></div>
Because the other thread (primordial thread) was waiting to acquire the console, and it acquired it at the moment thread 2 relinquished it.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
3) after printing said 'yay', why do I have to hit (void) in the thread #1 before getting the error repl in thread 2? why doesn't the error immediately happen<br>
</blockquote>
<br></div>
Same as 2).  The console is being multiplexed fairly between the two threads that need to access it.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
4) it seems like i'm ping-ponging between the two threads on the REPL. Is there anyway I can control this myself? (i.e. some command to jump me to thread1, some to jump me to thread2?)<br>
</blockquote>
<br></div>
You can use the ,(v #2) command to visit thread #2.  But that's mainly useful to interrupt a thread in mid execution.<br>
<br>
The ideal solution is to use an IDE which can present to the user several independent interaction windows. For example the Jazz IDE (Jedi).<br>
<br>
Alternatively, you can try the following "remote-debugging" code (for Unix + X11) which will pop up a new xterm for each REPL.  It is meant as a proof of concept, so I'm not sure how much mileage you can get out of it.<br>
<font color="#888888">
<br>
Marc<br>
<br>
</font><br><br>
<br></blockquote></div><br>