[M3devel] SchedulerPosix/Win32/sockets
Jay K
jay.krell at cornell.edu
Mon Apr 19 14:11:52 CEST 2010
short story:
I think we should have SchedulerPosix.IOWait and SchedulerPosix.IOAlertWait, but not SchedulerPosix.WaitProces, on Win32. With the CARDINAL changed back to INTEGER.
As well, as before, I'd like to only have one implementation of this. Currently there are two identical copies, due to Cygwin. But this proposal is for regular Win32.
long story:
Win32 has select, for sockets. Instead of a bitset, it uses an array of 64, so doesn't have the problem that poll fixes.
SocketPosix.m3 makes sockets non-blocking and uses IOWait and IOAlertWait.
SocketPosix.Connect/Accept are alertable.
SocketWin32.Connect/Accept are not alertable.
That seems wrong, eh?
I assume this difference is due to original implementers not realizing their options on Win32.
I assume this difference would be good to remove.
IOWait is merely a call to select (assuming kernel threads).
In rewritten-in-C, I can easily just #ifdef and call select on Win32.
IOAlertWait is implemented by polling via select/poll for up to a maximum of a second at a time, testing alert between each.
It is this code that I don't think should be duplicated. We already have two copies of it due to Cygwin.
(I think we might be able to do better on Win32 though, by using Win32 alerting as part of Modula-3 alerting, but for the time being, sharing code with Posix that polls every second would be ok.)
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100419/3870798c/attachment-0002.html>
More information about the M3devel
mailing list