Console Hiding (was:xterm is a console program?)
Early Ehlinger
early@respower.com
Thu May 22 19:50:00 GMT 2003
"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
More information about the Cygwin-xfree
mailing list