Windows Compilation problem

Marc Lehmann schmorp at schmorp.de
Thu Jun 5 10:27:03 CEST 2008


On Wed, Jun 04, 2008 at 08:18:09PM -0700, Matt Tolton <matt at tolton.com> wrote:
> This allowed things to work until a socket was closed and fd_ebadf
> (and hence fd_valid) was called, causing another call to

note that if ev_ebadf is called then you have a programming bug in your
application, namely you close the socket without deregistering the watcher.
libev doesn't support registering watchers for invalid file descriptors
(think about it, the fd could already be reused

>        _VALIDATE_CLEAR_OSSERR_RETURN((_osfile(fh) & FOPEN), EBADF, -1);
> 
> Might I ask...what is the _get_osfhandle() call for?  It seems like it
> is ok to just use the handle returned by socket() in my case.

It converts a file descriptor into an osf handle as required by the winsocket
select fucntion.

Not calling it causes crashes for correctly-written programs. removing the
calls to them might work on some windows platforms, but will cause crashes
on others, so that is a definite and big no-no.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at goof.com
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list