X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=win32%2Fwin32sck.c;h=5c2b73f95a6a535e80e69cf34df0415d0332c949;hb=26b3385cfa7a4193b7fdcd1e1e62a8894e9d9198;hp=5ac2ef6c65c9849abb5d8ae1a76cba0a5a77585b;hpb=2d7a92375815264badaef23c612657cbd4799f31;p=p5sagit%2Fp5-mst-13.2.git diff --git a/win32/win32sck.c b/win32/win32sck.c index 5ac2ef6..5c2b73f 100644 --- a/win32/win32sck.c +++ b/win32/win32sck.c @@ -17,6 +17,13 @@ #include #include "EXTERN.h" #include "perl.h" + +#if defined(PERL_OBJECT) +#define NO_XSLOCKS +extern CPerlObj* pPerl; +#include "XSUB.h" +#endif + #include #include #include @@ -269,6 +276,15 @@ win32_select(int nfds, Perl_fd_set* rd, Perl_fd_set* wr, Perl_fd_set* ex, const int i, fd, bit, offset; FD_SET nrd, nwr, nex, *prd, *pwr, *pex; + /* winsock seems incapable of dealing with all three null fd_sets, + * so do the (millisecond) sleep as a special case + */ + if (!(rd || wr || ex)) { + Sleep(timeout->tv_sec * 1000 + + timeout->tv_usec / 1000); /* do the best we can */ + return 0; + } + StartSockets(); PERL_FD_ZERO(&dummy); if (!rd) rd = &dummy, prd = NULL; @@ -604,7 +620,7 @@ win32_savecopyservent(struct servent*d, struct servent*s, const char *proto) d->s_proto = s->s_proto; else #endif - if (proto && strlen(proto)) + if (proto && strlen(proto)) d->s_proto = (char *)proto; else d->s_proto = "tcp";