Document the fact that Random and setRandom are not reentrant (so not thread-safe)

This commit is contained in:
Gael Guennebaud
2014-01-07 20:17:59 +01:00
parent a6a57748dd
commit ac409f51f1
3 changed files with 20 additions and 6 deletions

View File

@@ -39,6 +39,8 @@ int main(int argc, char** argv)
}
\endcode
\warning note that all functions generating random matrices are \b not re-entrant nor thread-safe. Those include DenseBase::Random(), and DenseBase::setRandom() despite a call to Eigen::initParallel(). This is because these functions are based on std::rand which is not re-entrant. For thread-safe random generator, we recommend the use of boost::random of c++11 random feature.
In the case your application is parallelized with OpenMP, you might want to disable Eigen's own parallization as detailed in the previous section.
*/