← Back to team overview

yade-dev team mailing list archive

Re: How to use a plugin

 

> But when I display the output from C using omp_get_max_threads, it shows 1 !
That is weird....
> 
> But somehow disabling parallel execution using globalMutex solved the problem of my global variable get messed up, althugh  parallelism is still on.  Do you know why?
Parallel call will wait for the mutex to be freed, therefore only one
thread will enter the function body. But I think it will susceptible to
breaking, since there is pause between assignment of the global and
locking the mutex. If another thread modifies the global at this moment,
the first call will get wrong ids. Perhaps you will not even note, since
it will just work on another interaction, the first one being
unprocessed. Watch out, multi-threading issues are hanrd to debug, as
they don't occur deterministically.

Cheers, v.





Follow ups

References