tags:

views:

52

answers:

1

Hello

Can I use openmp in C++ objects' constructors?

What will be done, when there will be a global static object with such constructor?

+1  A: 

yes. imagine this to be the same as calling OpenMP function from constructor.

A second point, I do not know, it may depend on implementation. I am fairly certain the pthreads implementation should be okay for global static objects. http://www.terboven.com/download/poster_A0_portrait_neu_formatiert.pdf

Static initialization maybe somewhat difficult to get right, http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12. keep in mind that static object are initialized before main.

aaa
When will openmp start threads? At the main() start or before it?
osgx
@osgx should be whenever parallel region is encountered.Exact thread implementation is implementation dependent (maybe reusable/ single threads)
aaa