This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Console Hiding (was:xterm is a console program?)


"Christopher Faylor" <cgf@redhat.com> wrote:
> The Cygwin DLL already uses something similar.  Your code is a little
> too simplistic to be reliable, however.  You are not accounting for the
> fact that the title change takes some time to "settle down".  You need
> to check repeatedly in a loop, waiting between each check.

Hmm - I wasn't aware of this - thanks for the tip.  I have yet to see
evidence of this, but that could simply be my hardware/OS.  Is this a 9x
trait?  On NT 4.0, 2k and XP I have never noticed any latency between
SetConsoleTitle and FindWindow succeeding.

There is also the problem of the race condition that I document in the code.
I don't see any way around that other than a global named mutex, but of
course that only helps if everybody honors the mutex.  Some other
(non-cygwin) app in the same process group could conceivably cause problems
by using SetConsoleTitle at a bad moment.

And of course there's little-to-no error handling, but that's b/c I was
merely trying to present something for exposition.  For example, I don't
check the return value of SetConsoleTitle at all; sure, it's unlikely that
it would ever fail given the success of GetConsoleTitle immediately before,
but it's not impossible.


--
-- Early Ehlinger CEO, ResPower Inc - Toll-Free : 866-737-7697
-- www.respower.com -- 500+ GHz Supercomputer Starting At USD$0.50/GHz*Hour






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]