Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: win32 equivalent of select()

Author: Alex Boby

Date: 12:25:42 05/28/01

Go up one level in this thread


On May 28, 2001 at 05:33:43, David Blackman wrote:

>On May 28, 2001 at 01:46:16, Alex Boby wrote:
>
>>
>>Other than the dinky _kbhit(), is there a win32 equivalent of the all mighty
>>select()? If not,.. how does everybody poll for input under windows?
>>
>>Sorry for the stupid question but I had a tough time finding anything with msdn.
>>
>>Alex
>
>There is select() but it only works on sockets. It's in the winsock library, and
>probably declared in winsock.h if you use C. Maybe that is enough? I suppose you
>could make it work by having a little program sit on each non-socket thing you
>want to watch, and then have the little programs talk to the main program via
>sockets.
>
>Another way is to do an event loop and have the system do callbacks any time
>anything interesting happens. I haven't had to do that yet so i'm not sure of
>details like the actual calls used, but it's the way the MS-windows programmers
>around here usually do it. It sounds horrible.
>
>You could also go multi-threaded with one thread for each thing you want to do
>I/O to, and just do ordinary blocking I/O, since it only blocks the one thread.
>Again this sounds fairly horrible if you think about deadlock avoidance,
>synchronisation etc. This is the approach i am trying to get away with at work.
>(It won't come up for me with chess programming, because there is no way i am
>going to try to program MS-windows just for fun.)

I think i'll try the i/o thread out, seems like it'd be the most efficient.

Alex




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.