yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #02653
Re: Run Engine in PeriodicRunner()
> Ehm I was meaning the variable called "nThreads". Just because I saw
> this one as a private variable in the sync() function and I was
> guessing about its value.
It is initialized in ForceContainer ctor to omp_get_max_threads() value.
Basically you could replace nThreads by omp_get_max_threads()
everywhere, but it would be slower (extra function call every time).
Each thread has its own storage where force can be incremented
independently of other threads; that prevents the necessity of mutual
exclusion. Thread number is found by calling omp_get_thread_num(), which
is guaranteed to be < omp_get_max_threads() == nThreads.
v.
References