Question about tty.cc

Chris January chris@atomice.net
Wed May 22 15:17:00 GMT 2002


I've tracked down the "dup(/dev) failed" on startup error to the following
section of code in tty.cc :

      char buf[40];

      __small_sprintf (buf, "cygwin.find.console.%d", myself->pid);
      SetConsoleTitle (buf);
      Sleep (40);
      console = FindWindow (NULL, buf);
      SetConsoleTitle (oldtitle);
      Sleep (40);
      ReleaseMutex (title_mutex);
      if (console == NULL)
 {
   termios_printf ("Can't find console window");
   return -1;
 }

Can anyone tell me what the Sleep (40) lines are there for? If they are
there to give the console window time to appear, may I suggest the delay is
too short and that may be a possible cause of the error I am seeing?
If this is the case one solution might be to loop a few times if the window
is not found to give it time to appear, in the majority of cases when the
window has already appeared, there will be no extra delay but it will catch
those few times when the window is just being a little slow.
i.e.
for (int i=0; i < 20 && console == NULL; i++)
  {
      Sleep (40);
      console = FindWindow (NULL, buf);
  }

Regards
Chris



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list