Manpage says otherwise:
And some tutorial says:
I don't see how — |
That said, if this is actually a race between — |
In reply to this post by David T Lewis
Tobias, you need to read the code to see why we can't ditch aioPoll. Perhaps we could ditch the select call in socketWritable, but we would need to test on all platforms. However, here's how you can see that select does indeed answer 0 for a writable socket on macOS (I'm using 10.13.6).
— |
In reply to this post by David T Lewis
(I looked into it per your request :)) — |
In reply to this post by David T Lewis
It's late but why do you hardcode the first parameter of select to 1? While I see your fd seems to be higher than 0? — |
In reply to this post by David T Lewis
Hi Holger, first I don’t do anything. This code is historical. I’m simply trying to understand it and fix it. Second, the reason it’s 1 is that it’s testing for writability of a single file descriptor which happens to be that of a socket. — |
In reply to this post by David T Lewis
The first parameter of select should be the largest file descriptor in the set + 1, so s + 1 in this case. — |
In reply to this post by David T Lewis
The set has exactly one element, so this change is unnecessary. — |
In reply to this post by David T Lewis
Hi shaping. That’s a misreading. The first argument is the number of file descriptors in the various fds arguments: The nfds argument specifies the range of descriptors to be tested. The first nfds descriptors shall be checked in each set; that is, the descriptors from zero through nfds-1 in the descriptor sets shall be examined. — |
In reply to this post by David T Lewis
Hi Eliot, it's me Levente. My comment was about the comparison of select's return value with 1 instead of checking whether it's greater than 0. The first argument of select is ignored on windows: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-select#parameters
See https://www.man7.org/linux/man-pages/man2/select.2.html. — |
In reply to this post by David T Lewis
Hi Levente, oops, too many messages :-). I just wanted to make the Windows and Unix versions read the same. If you think == 1 is better than > 0 then I shall change both. — |
In reply to this post by David T Lewis
The commit that replaced But great that we resolved that. — |
In reply to this post by David T Lewis
Okay, it makes sense to have the same code, but then the first argument should be s + 1. — |
In reply to this post by David T Lewis
You’re quite right. I had misread. An improvement to socketWritable would be to use poll on Unix. And if would be very nice to have an aio.c alternative that used epoll. — |
In reply to this post by David T Lewis
epoll wouldn't be a good choice, because many unix systems don't have it. I think libevent would be a much better choice, covering all currently supported operating systems (perhaps barring acorn. is that supported?), including windows: https://libevent.org/ — |
In reply to this post by David T Lewis
Well platforms/Unix/vm/aio.c is only used on Unixes (Linux/Solaris/MacOS). I would be very happy to see a contribution using either epoll or libevent. Most conveniently if would be a replacement for all of aio.c in a different file name because this will be easier to read, and then we can rename aio,c to be say aioViaSelect.c, aioViaLibevent.c etc which can void their contents using an ifdef controlled by config.h — |
In reply to this post by David T Lewis
BTW, who am I talking to, smalltalking? — |
In reply to this post by David T Lewis
It's still me, Levente. — |
In reply to this post by David T Lewis
The RISC OS stuff does still work (non-cog, sadly) but claiming it is 'supported' would be a bit grandiose. I do have some RSIC OS Pi still but time to do anything with them is pretty much non-existent. And of course, it's not like RISC OS is going to suddenly become the world leading OS again. > On 2020-10-10, at 6:31 AM, smalltalking <[hidden email]> wrote: > > > epoll wouldn't be a good choice, because many unix systems don't have it. I think libevent would be a much better choice, covering all currently supported operating systems (perhaps barring acorn. is that supported?), including windows: https://libevent.org/ > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub, or unsubscribe. > tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Strange OpCodes: FR: Flip Record |
Free forum by Nabble | Edit this page |