From: Andrea Beber
Subject: Questions about CMUCL...
Date: 
Message-ID: <32FAF34E.41C67EA6@irst.itc.it>
I am a beginner.
I use CMU Common Lisp and have any questioins:

is it multithreaded (multiprocess) ?

How can I specify a timeout (I use the function accept-tcp-connection) ?

Where can I find documentations about these extensions ?


THANKS !!!


    Andrea Beber: ·····@irst.itc.it
From: Thorsten Schnier
Subject: Re: Questions about CMUCL...
Date: 
Message-ID: <x7zpxgjh33.fsf@Rincewind.arch.su.edu.au>
Andrea Beber <·····@irst.itc.it> writes:

> I am a beginner.
> I use CMU Common Lisp and have any questioins:
> 
> is it multithreaded (multiprocess) ?

No, it doesn't have a scheduler. You can use some event-driven functions,
but that is not the same.

> 
> How can I specify a timeout (I use the function accept-tcp-connection) ?

You would have to rewrite 'accept-tcp-connection', unfortunately, and I am
not even sure if that has success (see below).

> 
> Where can I find documentations about these extensions ?
> 

Only in the source. Here is the definition for accept-tcp-connection

(defun accept-tcp-connection (unconnected)
  (declare (fixnum unconnected))
  (with-alien ((sockaddr inet-sockaddr))
    (let ((connected (unix:unix-accept unconnected
                                       (alien-sap sockaddr)
                                       (alien-size inet-sockaddr :bytes))))
      (when (minusp connected)
        (error "Error accepting a connection: ~A" (unix:get-unix-error-msg)))
      (values connected (slot sockaddr 'addr)))))


unix-accept is just a call to the unix function 'accept'. What this function
does depends on the way the socket was created. If it was created with a 
non-blocking flag, it returns immediately, with an appropriate message (check 
the unix man-page on 'accept). Now how you mark a socket nonblocking I 
couldn't find out, it also depends on what hardware you are using. 

(in other words, if possible at all, only with some low-level hacking)

If you are desperate, write a function in C that does the accept, possibly
setting up a timer first to interrupt itself after a certain time...


BTW: read-char-no-hang doesn't work correctly with socket-streams, it 
sometimes misses new incoming data.



> 
> THANKS !!!
> 
> 
>     Andrea Beber: ·····@irst.itc.it



thorsten

----------------------------------------------------------------------- 
       \    k                                       
        \   e                                          Thorsten Schnier
         \  y                       
     /\   \                              Key Centre of Design Computing
    /     / c                                      University of Sydney
    \    /  e                                                  NSW 2006
     \  /   n                      
      \/    t                                 ········@arch.usyd.edu.au 
    DESIGN  r                    http://www.arch.usyd.edu.au/~thorsten/
  COMPUTING e