Problem with select on windows

Bert Belder bertbelder at gmail.com
Tue Jan 25 00:54:20 CET 2011


See the attached test (both files needed).

Okay, the problem isn't that the handle doesn't get updated, but merely that
vec_ri and vec_wi in contain the handle that *was* associated with the fd.
After the handle is updated, vec_ri/vec_wi still contain that old handle,
but select_modify doesn't remove it because the handle that must be removed
is lost, overwritten when updating.

- Bert

> -----Oorspronkelijk bericht-----
> Van: Marc Lehmann [mailto:schmorp at schmorp.de]
> Verzonden: maandag 24 januari 2011 22:24
> Aan: Bert Belder
> CC: libev at lists.schmorp.de
> Onderwerp: Re: Problem with select on windows
> 
> On Mon, Jan 24, 2011 at 10:04:42PM +0100, Bert Belder
> <bertbelder at gmail.com> wrote:
> > There is a problem with libev/select on windows. When a socket that
> is being
> > observed with an ev_io watcher is closed, and the same fd gets re-
> used for
> > another socket in the same tick (so before control to is returned to
> libev),
> > the windows handle that is cached in ANFD->handle is not updated.
> 
> Actually, according to the code, the cached handle gets updated on
> every
> start of an I/O watcher that has it's fd updated.
> 
> Are you sure you stop/set/start the watcher? (See "The special problem
> of
> disappearing file descriptors").
> 
> If you do, can you make a small testcase the illustrates the problem? I
> can't see how it can not update the cached fd (there might be a problem
> with updating it, but that doesn't seem to be what you see).
> 
> > Is there a better solution to this problem?
> > And if not, any chance that this patch could be landed?
> 
> It should just work, and if it doesn't, it needs to be made to work.
> 
> --
>                 The choice of a       Deliantra, the free code+content
> MORPG
>       -----==-     _GNU_              http://www.deliantra.net
>       ----==-- _       generation
>       ---==---(_)__  __ ____  __      Marc Lehmann
>       --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
>       -=====/_/_//_/\_,_/ /_/\_\
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.h
Type: application/octet-stream
Size: 69 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20110125/f1114868/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: application/octet-stream
Size: 2403 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20110125/f1114868/attachment-0001.obj>


More information about the libev mailing list