Hi Jasper,

Looks like you have found an interesting question here...

First - there are no multiple concurrent threads in the core. So we are safe 
(and so is the API, without being thread-safe).

However, what you saw is right: each command executes in a new thread. We 
designed it on purpose, with one of the reason being that this thread can be 
what we call the "storeCommand" which manages events from outside the main 
thread (UI, interruption). Another idea was that - later - to allow 
multithreaded execution (under some serious constraints).

Now, your point about COM loading, and thread-local storage, is very valid, and 
may very well mean that we should change this. 

We will study if/how we could modify that... we'll keep you posted.

Thanks *a lot* for reporting this; it's exactly what we released the alpha for, 
and even though we were hoping we would not have such questions, it's better to 
have them now than later...

for the Scilab team,
François Granade



On Aug 4, 2015, at 9:21 AM, jasper van baten <[email protected]> wrote:

> Does anybody know what threading model is used in Scilab 6 alpha? I am 
> referring to the default mode of operation, and not while executing 
> parallel_for, or MPI as described here 
> (http://wiki.scilab.org/Documentation/ParallelComputingInScilab).
> 
> If there are multiple core threads that execute concurrently, then all 
> api-scilab code needs to be written in a thread-safe re-entrant safe manner. 
> I doubt this is the case. 
> 
> If there is one core thread alive at any point, it would make sense for this 
> to remain the same thread, which does not appear to be the case. If not the 
> same thread, any application that depends on apartment threaded COM objects 
> or thread local storage will no longer function as it did in Scilab 5. The 
> solution may be to synchronize such applications over a private thread, but 
> that surely will come at a performance cost.
> 
> Having some idea about the threading model that is intended and used would be 
> helpful.
> 
> Best wishes, 
> 
> Jasper.
> 
> On 7/31/2015 18:35, jasper van baten wrote:
>> All,
>> 
>> What's the story with threading in Scilab 6? Whereas previous versions 
>> appeared to be single threaded from an external DLL point of view, I see 
>> that the DLLmain function gets called by a one thread, whereas interface 
>> routines get called from another thread. Worse, looks like each interface 
>> routine call is made from a new thread. What is the threading model?? Is 
>> there a limited number of threads, or are threads created on the fly?
>> 
>> Thanks, best wishes, 
>> 
>> Jasper
>> 
>> 
>> _______________________________________________
>> users mailing list
>> [email protected]
>> http://lists.scilab.org/mailman/listinfo/users
> 
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to