title: How to run multiple ncurses window using pthread
body: <p>I am trying to simply run two ncurse windows using pthread. The code i have written is as follows:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;pthread.h&gt;
  #include&lt;ncurses.h&gt;
  #include&lt;sys/ioctl.h&gt;
  #include&lt;string.h&gt;
  #include&lt;unistd.h&gt; 
  
   struct winsize w;
   WINDOW *win1,*win2;
   void createWin1(void){
         while(1){
  
                  char  buffer[1024];
                  win1=newwin(0,0,40,50);      
                  box(win1,0,0); 
                  wrefresh(win1); 
                  sleep(1);
              }
  }     
  void createWin2(void){
            while(1){
                     win2=newwin(40,50,40,60);
                     box(win2,0,0);
                     wrefresh(win2);
                     sleep(1);
                    }
      }
  void main()
    {    initscr();
         noecho();
         cbreak();
         start_color();
         use_default_colors();
         init_pair(1,COLOR_WHITE, -1);              
         pthread_t p1,p2;       
         pthread_create(&amp;p1,NULL,(void *)createWin1,NULL);    
         pthread_create(&amp;p2,NULL,(void *)createWin2,NULL);
         pthread_join(p1,NULL);
         pthread_join(p2,NULL);
  
  }
  </code></pre>
  
  <p>Now the problem is I cant run two windows in parallel .This will show unexpected output. Can anyone please help me to find out the issue in my code.</p>