Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-WM-Posted-At: avacado.atomice.net; Wed, 22 May 02 20:29:44 +0100 Message-ID: <003301c201c7$06f822c0$0100a8c0@advent02> From: "Chris January" To: Subject: Question about tty.cc Date: Wed, 22 May 2002 20:29:44 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 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/