> On Wednesday 09 March 2016 09:07:38 you wrote:
>> Hello,
>>
>> Juraj Variny writes:
>> > Hello,
>> >
>> > can you please tell me how to:
>> >
>> > 1. Initialize lisp environment in a thread that was already created by
>> > C/C++ app? Is it possible for it to share existing lisp environment?
>>
>> There is an example in examples/embed directory (file hello.c). What do
>> you mean by sharing an existing lisp environment? cl_boot creates an
>> environment for this instance.
>
> Say I have main thread, where cl_boot was called, with some lisp environment.
> Then I call cl_boot in some other pre-existing thread, would it be able to
> access lisp environment of the main thread, evaluate symbols defined there,
> call functions etc? This is what I meant with shared environment.

It is enought to call cl_boot once. Calling it a second time won't do
any harm, but the cl_boot isn't thread-safe, so don't call it twice at
the same time from different threads.

After calling cl_boot once you should be able to work with lisp from any
thread.
 
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.