From: Sam S. <sd...@gn...> - 2002-10-02 15:18:09
|
> * In message <AOE...@sy...> > * On the subject of "RE: [clisp-list] FFI - Creating c-places in LISP? -> READ-SOME-SEQUEN CE" > * Sent on Wed, 2 Oct 2002 08:01:08 -0700 > * Honorable "Dave Richards" <da...@sy...> writes: > > > The contract of the READ-*-ONCE (WRITE-*-ONCE) functions is to make a > > single read() (write()) OS call. They will return the number of > > objects (bytes or characters) read (written) - just like READ-SEQUENCE > > (WRITE-SEQUENCE). > > If this number is smaller than the size of the SEQUENCE argument, the > > next i/o call will either block or return EOF (i.e., no more data is > > immediately available). > > We can even return a second value: NIL, :EOF, or :BLOCK. > > > > I think this is what you want. Am I right? > > In the previous discussion about TCP-based servers, I raised the issue > than the sockets needed to be marked non-blocking. I thought we'd > concluded that doing so could potentially break existing stream code. > Did I misunderstand? Non-blocking is required to ensure that each I/O > only performs what is possible with no delay and that the server is > then available to perform other work. This is what I meant by partial > read()s/write()s. CMIIAW: if you have a regular blocking socket and you call read/write on it and it has _something_, it will not block. the only way it might block is if it has _nothing_. So you can use the regular CLISP buffered socket streams with the proposed WRITE-SEQUENCE-ONCE and READ-SEQUENCE-ONCE and use the second value to decide whether the next i/o will block or not. Alternatively you can use SOCKET-STATUS before i/o: this should be cheap enough because you will be doing block i/o, not byte i/o. WAIM? -- Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux <http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/> <http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html> The software said it requires Windows 3.1 or better, so I installed Linux. |