I once thought clicker would rather have system calls like
Code: Select all
CommPort.recv(&msg); // locks until a message arrives
CommPort.monitor(OtherCommPort);
CommPort.monitor(YetAnotherCommPort);
ReadyPort=CommPort.recv(&msg);
// monitors both CommPort, OtherCommPort and YetAnotherCommPort and tells which one has been read.
Code: Select all
while (1) {
// memcpy the whole bitmap under the hook
ready_fds=read_fds;
readies=select(max_fd,&ready_fds,...);
for (i=0;i<max_fd;i++) {
if (!readies) break; // we're all done.
if (FD_ISSET(ready_fds,i)) {
do_stuff_with_fd(i);
readies--;
}
}
}
So would it make sense to have one API that simply applies FIFO policy and assume everyone will be happy with that, but that where the kernel acts like an "enumerator" of ready handles and one API that returns a bitmap and then let the user code do whatever it wants with that ?
Anyone has experience with a similar API in non-unix systems ?