<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>> On Wednesday 09 March 2016 09:07:38 you wrote:<br>
>> Hello,<br>
>><br>
>> Juraj Variny writes:<br>
>> > Hello,<br>
>> ><br>
>> > can you please tell me how to:<br>
>> ><br>
>> > 1. Initialize lisp environment in a thread that was already created by<br>
>> > C/C++ app? Is it possible for it to share existing lisp environment?<br>
>><br>
>> There is an example in examples/embed directory (file hello.c). What do<br>
>> you mean by sharing an existing lisp environment? cl_boot creates an<br>
>> environment for this instance.<br>
><br>
</span>> Say I have main thread, where cl_boot was called, with some lisp environment.<br>
> Then I call cl_boot in some other pre-existing thread, would it be able to<br>
> access lisp environment of the main thread, evaluate symbols defined there,<br>
> call functions etc? This is what I meant with shared environment.<br>
<br>
It is enought to call cl_boot once. Calling it a second time won't do<br>
any harm, but the cl_boot isn't thread-safe, so don't call it twice at<br>
the same time from different threads.<br>
<br>
After calling cl_boot once you should be able to work with lisp from any<br>
thread.</blockquote><div> </div><div>This "working with lisp from any thread" I have tried, and got segfaults and corruption immediately. Seems that ecl_env_ptr is thread-local variable and should be properly initialized for every thread where lisp is used. </div></span><div><br></div><div><br></div><div> </div></div></div></div>
</div><br></div>