title: C++ : fork/exec or pthread?
body: <p>I'm writing a program, and once a button is pushed, I have to execute a server process (that will stop only if I decide to kill him).<br>
  To execute this process, I decided to use fork/execv mechanism :</p>
  
  <pre><code>void Command::RunServer() {
  
      pid = fork();
  
      if (pid==0) {
          chdir("./bin");
          char str[10];
          sprintf(str,"%d",port);
          char *argv[] = {"./Server", str};
          execv("./Server",argv);
      }
      else {
          config-&gt;pid = pid;
          return;
      }
  }
  </code></pre>
  
  <p>And in the method "button pushed", I do:  </p>
  
  <pre><code>command-&gt;RunServer();
  </code></pre>
  
  <p>It seemed to work nicely a few days ago... and now i get error :</p>
  
  <pre><code>main: xcb_io.c:221: poll_for_event: Assertion `(((long) (event_sequence) - (long) (dpy-&gt;request)) &lt;= 0)' failed.
  </code></pre>
  
  <p>Should I try to switch to pthread? Did I do something bad?  </p>
  
  <p>Thanks,<br>
  eo</p>