How to save process threads when using source code blocks in org-mode's babel?

Hello, This is on Windows, on a several months old Slime. I am using org-mode's babel with the lisp module to document a data analysis project. In one of the first code blocks I initialize a stream that communicates with GNUPlot. Subsequent blocks (BEGIN_SRC...END_SRC) send plot commands, one plot per code block. In a slime session, I can generate multiple plots communicating with that one stream. But in the org-mode, after successfully creating the first plot, the subsequent ones raise the error that the stream is private to a thread. So I have to restart GNUplot for each plot. In a previous email exchange on the list (unrelated to org-mode) it was pointed out that executing code via REPL in Slime uses a different thread then executing code from a lisp buffer. I assume something like that is going on here as well. So, is there a way for me to store the process thread which invoked GNUplot, and use that one for execution of subsequent code blocks? Thanks, Mirko

On Mon, Apr 4, 2016 at 10:28 PM, Mirko Vukovic <mirko.vukovic@gmail.com> wrote:
But in the org-mode, after successfully creating the first plot, the subsequent ones raise the error that the stream is private to a thread. So I have to restart GNUplot for each plot.
I'm guessing you're using Clozure CL. If you pass :sharing :external or :sharing :lock (whichever is more appropriate) to ccl:run-program then the stream won't be thread-private. HTH, -- Luís Oliveira http://kerno.org/~luis/

On Mon, Apr 4, 2016 at 8:04 PM, Luís Oliveira <luismbo@gmail.com> wrote:
On Mon, Apr 4, 2016 at 10:28 PM, Mirko Vukovic <mirko.vukovic@gmail.com> wrote:
But in the org-mode, after successfully creating the first plot, the subsequent ones raise the error that the stream is private to a thread. So I have to restart GNUplot for each plot.
I'm guessing you're using Clozure CL.
Correct :-)
If you pass :sharing :external or :sharing :lock (whichever is more appropriate) to ccl:run-program then the stream won't be thread-private.
I'll give it a try
HTH,
-- Luís Oliveira http://kerno.org/~luis/
participants (2)
-
Luís Oliveira
-
Mirko Vukovic