title: Program with graphics being aborted, even though XInitThreads was called
body: <p>I have just started using Graphics in C, and I encountered this error while running a simple program that draws concentric circles:</p>
  
  <pre><code>user@user:~/Documents/C$ gcc circle.c -lX11 -lgraph
  user@user:~/Documents/C$ ./a.out
  [xcb] Unknown sequence number while processing queue
  [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
  [xcb] Aborting, sorry about that. a.out: ../../src/xcb_io.c:274: poll_for_event:
        Assertion '!xcb_xlib_threads_sequence_lost' failed.
  Aborted (core dumped)
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>[xcb] Unknown sequence number while processing queue
  [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
  [xcb] Aborting, sorry about that. a.out: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
  </code></pre>
  
  <p>I looked up some forums on the internet and they suggested that adding <code>#include&lt;X11/Xlib.h&gt;</code> and calling <code>XInitThreads()</code> in the beginning of <code>main()</code> would solve the problem, But I still get the <strong>same</strong> error while running.</p>
  
  <p>I've attached the code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;graphics.h&gt;
  #include&lt;X11/Xlib.h&gt;
  
  int main()
  {
      XInitThreads();
      int gd=DETECT, gm,r,x;
      initgraph(&amp;gd,&amp;gm,NULL);
  
      setbkcolor(WHITE);
      setcolor(BLACK);
      for(r=10;r&lt;100;r+=10)
      {
          circle(150,150,r);
      }
      scanf("%d",&amp;x);
      closegraph();
  
      return 0;
  }
  </code></pre>
  
  <p>I use Ubuntu 14.04 and GCC for compiling. </p>