[Haskell-cafe] Computations that can time out + gathering feedback from threads

Joel Reymont joelr1 at gmail.com
Mon Oct 31 14:19:06 EST 2005


Folks,

I need to implement computations that can time out (connecting to a  
server, reading from socket, etc.), plus gather feedback from a few  
thousands of threads. What is the best way to implement this?

Do I launch a thread to sleep and a thread to connect/read from  
socket and use something like Shared Transaction Memory to wait for  
either of the two to finish?

Also, my "simple scripting engine" launches a few thousands of  
scripts that connect to a server, exchange commands and update their  
internal state. I need to wait for all these to finish and get the  
results of their execution.  My scripts are a combination of monads  
and I run them with runXXX( ... ) from the IO monad so that I can  
inspect the resulting state.

Is there an elegant solution for waiting for all the threads to  
complete and then figuring out how many of these are in good share  
according to their end state?

     Thanks, Joel

--
http://wagerlabs.com/







More information about the Haskell-Cafe mailing list