[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaSocket, Win32 and select()
- From: Diego Nehab <diego@...>
- Date: Fri, 28 Jan 2005 01:38:18 -0500 (EST)
> I don't insist that it is not a bug. It may well be a bug. I do
> not program against the winsock stack, anyway.
Sigh... :) Wasn't the comment in the manual specific to WinSock?
> All I said was that I did not believe that you could, in general,
> know that a send() would not return EWOULDBLOCK (or, alternatively,
> block) even though select() said it was writable.
But I know that! If you check the LuaSocket code, you will see that
this is tested for in the Unix version. The Windows code has also been
All I am saying is that, in Windows, the select will return writable,
then you try to write, it says it would block, then you select again, it
tells you it's writable, and try to write, and it fails again and so on
and so forth, nothing in between, no other threads. It's a bug.
Sometimes it throws CPU usage to the skies, sometimes it doesn't.
They claim it doesn't happen in NT 4.0. Might happen even if they claim
it doesn't. It doesn't matter, the code has to be prepared to see this
And users of LuaSocket have to be aware of the possibility of busy wait
when they run their programs on Windows because select just doesn't
work. There is nothing I can do about it short of writing a worm to
infect everybody's computer and patch this bug.