title: Share scoped variable in OpenMP
body: <p>I'm working with OpenMP and would like to share variable that's declared inside scoped block between threads. Here's overall idea of what I'm doing:</p>
  <pre><code>#pragma omp parallel
  {
      // ...parallel code...
      {
          uint8_t* pixels;
          int pitch;
  #pragma omp barrier
  #pragma omp master
          {
              // SDL video code must be run in main thread
              SDL_LockTexture(renderTexture.get(), nullptr, (void**)&amp;pixels, &amp;pitch);
          }
  #pragma omp barrier
          // parallel code that reads `pixels` and `pitch` and writes to texture
  #pragma omp barrier
  #pragma omp master
          {
              // Once done, main thread must do SDL call again (this will upload texture to GPU)
              SDL_UnlockTexture(renderTexture.get());
          }
      }
  }
  </code></pre>
  <p>When compiled as is, <code>pixels</code> and <code>pitch</code> will be thread-private and set only in main thread, leading to segfault. Is there a way to share those variables without increasing their scope (declaring them before <code>#pragma omp parallel</code>) or needlessly joining and re-creating threads (leaving parallelized part and entering another <code>#pragma omp parallel</code> block)?</p>