title: Thread safety of local static array in C99
body: <p>The following is thread safe since each array element is accessed by only one thread (including the real world part not shown here):</p>
  
  <pre><code>static bool myArray[THREAD_COUNT] = {false}; // Only used in DoSomething()
  
  void DoSomething(uint8_t threadIndex)
  {
     myArray[threadIndex] = true;
     // Real world function is more complex
  }
  </code></pre>
  
  <p>Now consider the following code:</p>
  
  <pre><code>void DoSomething(uint8_t threadIndex)
  {
     static bool myArray[THREAD_COUNT] = {false};
     myArray[threadIndex] = true;
     // Real world function is more complex
  }
  </code></pre>
  
  <p>Is this function threadsafe too (especially considering the array initialization that takes place at first call of the function, not at startup)?</p>