[prog] making statements wait x number of seconds

Almut Behrens almut-behrens at gmx.net
Fri Sep 3 02:56:46 EST 2004


On Fri, Sep 03, 2004 at 09:50:40AM +1000, John Clarke wrote:
> On Thu, Sep 02, 2004 at 04:56:53 +0200, Almut Behrens wrote:
> 
> > methods. select has been around in Unix for a very long time. It should
> > thus compile and run on anything unix-ish (not on Windows, though!).
> 
> You *can* use select() on Windows with Cygwin (http://cygwin.com/).

Well, yes... but I wouldn't necessarily consider Cygwin being a part
of Windows -- more something like a rather heavy layer in between your
Unix program and the Windows core functionality.

But as you brought up Cygwin, one should also mention MinGW, which is
a somewhat more lightweight approach to compile and run Unix programs
under Windows, using a modified version of GCC to create code that's
solely based on standard Microsoft runtime libraries, i.e. without any
3rd-party layer in between.  Works surprisingly well, I've been told.
More info here: http://www.mingw.org/


Also, I have to confess I considerably over-simplified things by saying
select would not run on Windows. In fact, I may be wrong.  There is a
select() call as part of the winsock implementation:

http://msdn.microsoft.com/library/en-us/winsock/winsock/select_2.asp

I've never tried it myself, but I've heard rumours, that it doesn't
quite work the way you'd expect it to work when coming from a Unix
background.  But those issues might perhaps only have to do with there
being no such generic notion of file descriptors under Windows as we
have under Unix (IIRC, it was something with select() not working for
pipes...)
In case we're only interested in select()'s timeout facility, things
might even work as expected...  Anyone feel like trying?

Almut




More information about the Programming mailing list