From: Miguel Arroz
Subject: ACL -> Stream from one thread to the other
Date: 
Message-ID: <1091028965.461186@jubilee.esoterica.pt>
Hi!

  I nned to use a stream like a UNIX pipe, to transfer information 
(actually a character) between two different LISP threads.

  The problem is this: I have a thread that is blocked in 
wait-for-input-available, waiting for data to arrive to a UDP socket. 
Also, that thread has a list of messages that pther threads "send" to it. 
As the thread is blocked, I have to do something to unblock it, in order 
to take care of the message list. So, I was thinking about using this 
stream, like a pipe, and add it to the "wait-for-input-available" stream 
list. The problem is that I cannot find any useful info to do this. There 
are streams to write a file, streams to write in sockets... but how can I 
make a stream that has "both ends" inside the same LISP orocess, in 
different threads? Sort of like a UNIX pipe.

  If you know a better way to unblock the wait-for-input-available 
function, let me know.

  Yours

Miguel Arroz

From: Kenny Tilton
Subject: Re: ACL -> Stream from one thread to the other
Date: 
Message-ID: <cXQNc.104364$a92.57388@twister.nyc.rr.com>
Miguel Arroz wrote:
>   If you know a better way to unblock the wait-for-input-available 
> function, let me know.

Specify ":timeout 0", then set up a little loop polling the socket and 
checking for other work to do.

kenny

-- 
Cells? Cello? Celtik?: http://www.common-lisp.net/project/cells/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
From: Eric Daniel
Subject: Re: ACL -> Stream from one thread to the other
Date: 
Message-ID: <10gg35vf34rfb52@corp.supernews.com>
In article <·················@jubilee.esoterica.pt>, Miguel Arroz wrote:
>  Hi!
>  
>    I nned to use a stream like a UNIX pipe, to transfer information 
>  (actually a character) between two different LISP threads.
>  
>    The problem is this: I have a thread that is blocked in 
>  wait-for-input-available, waiting for data to arrive to a UDP socket. 
>  Also, that thread has a list of messages that pther threads "send" to it. 
>  As the thread is blocked, I have to do something to unblock it, in order 
>  to take care of the message list. So, I was thinking about using this 
>  stream, like a pipe, and add it to the "wait-for-input-available" stream 
>  list. The problem is that I cannot find any useful info to do this. There 
>  are streams to write a file, streams to write in sockets... but how can I 
>  make a stream that has "both ends" inside the same LISP orocess, in 
>  different threads? Sort of like a UNIX pipe.

How about a Unix pipe? :-)
You didn't say what implementation you use, but I'm sure it gives you a
way to:
  1) call pipe(2)
  2) make two streams out of the two resulting file descriptors
Now of course if you're running on Windows I don't know.
  
>    If you know a better way to unblock the wait-for-input-available 
>  function, let me know.

Can you set a very short timeout to wait-for-input-available,
such as 10 millisecods? If so you can check for messgaes
whenever wait-for-input-available times out. Be aware that:
  - this generates a small amount of CPU overhead when there are no
messages. The pipe method may or may not (depending on the implementation
of wfia.)
  - messages will have to wait up to 10 ms before your polling loop
sees them.

>  
>    Yours
>  
>  Miguel Arroz