title: Calling a function from inside a pthread?
body: <p>If I have a threaded function, and from inside it I call another function (that is located in a separate .c file), does each instance of the threaded function get it's own version of the called function? Example:</p>
  
  <h2>file 1</h2>
  
  <pre><code>void* threaded_func(void* data) {
    function2(...);
  }
  </code></pre>
  
  <h2>file 2</h2>
  
  <pre><code>int a;
  
  int function2(...) {
    int b;
  }
  </code></pre>
  
  <p>In my example, would int a be the same int a for all threads? What about for variables I define inside function2 (i.e int b)?</p>
  
  <p>Some context:</p>
  
  <p>I'm creating a simple HTTP server and my function2 is a serve_client function which should only return when the connection is closed. I'm having a problem that I think is due to some variables in file2 (int a) being overwritten for each new thread. I think my problem is me expecting a C source file to behave like a class would in Java.</p>