Re: OpenMP directive turns a statement into a real code block [with proper example]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tim Prince wrote:
> Peter Cech wrote:
> 
>>   # pragma omp parallel for
>>     for (int i = 0; i < 10; ++i) {
>>   #   pragma omp critical
>>       Class instance = create_and_register_new_instance();
>>
>>       instance.do_something();
>>     }
> But still, turning on OpenMP here creates a new inner block scope, as you
> suggested the first time, so the compiler is right to throw the error.  If
> you mean to keep the original block intact, you will need the additional
> set of {}.
But it seems pointless to make a parallel loop which contains nothing but
a critical section.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux