title: C++ std::thread invalid use of void expression
body: <p>I'm having an issue with my threading program. I know what the issue is, I just don't know how to fix it. I'm setting up an arbitrary number of threads to create a mandelbrot set and then to write it out to a ppm file. I'm using a vector of std::thread's and calling a Mandelbrot class member function to do the threading. The issue occurs here. I'm calling a void(void) function in which the compiler does not like. How do I go about fixing this so that the thread will execute the void(void) function? My code is below:</p>
  
  <h2>main.cpp</h2>
  
  <pre><code>int main(int argc, char **argv) {
     const unsigned int WIDTH = 1366;
     const unsigned int HEIGHT = 768;
     int numThreads = 2;
  
     Mandelbrot mandelbrot(WIDTH, HEIGHT);
  
     if(argc &gt; 1) {
        numThreads = atoi(argv[1]);
     }
  
     std::vector&lt;std::thread&gt; threads;
  
     for(int i = 0; i &lt; numThreads; ++i) {
        threads.emplace_back(mandelbrot.mandelbrotsetThreaded());
     }
  
     for(int i = 0; i &lt; numThreads; ++i) {
        threads[i].join();
     }
  
     return 0;
  }
  </code></pre>
  
  <h2>mandelbrot.cpp</h2>
  
  <pre><code>void Mandelbrot::mandelbrotsetThreaded() {
     while(true) {
        int row = 0;
        {
           std::lock_guard&lt;std::mutex&gt; lock(row_mutex);
           row = cur_row++;
        }
        if(row == width) return;
        createMandelbrotSet(row);
     }
  }
  </code></pre>