delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/22/16:20:06

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
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" <chris AT atomice DOT net>
To: <cygwin AT cygwin DOT com>
Subject: Question about tty.cc
Date: Wed, 22 May 2002 20:29:44 +0100
MIME-Version: 1.0
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019