[Haskell-cafe] STM, IO and event loops
Bulat Ziganshin
bulatz at HotPOP.com
Sun Nov 27 09:18:54 EST 2005
Hello Joel,
Sunday, November 27, 2005, 2:12:23 PM, you wrote:
JR> My poker bots are launched in separate threads but do not talk to
JR> each other right now. They just receive events from the network. I
JR> would like a poker bot to tell others to stop playing and exit, for
JR> example.
use async exceptions to do it
JR> 10k threads but it seems that disassociating bots from the network
JR> has some positive effects. I could compose packets by hand in the
JR> interpreter and feed them to the TChan by hand to test individual
JR> bots, for example.
as Tomasz already suggested, your bots must be parametrized by
action which gets next item, not by Chan/... itself.
current implementation:
bot chan = ... x<-readChan chan
must be:
bot reading = ... x<-reading
...
top_level = ... chan <- newChan
forkIO $ bot (readChan chan)
forkIO $ another_procedure (writeChan chan)
--
Best regards,
Bulat mailto:bulatz at HotPOP.com
More information about the Haskell-Cafe
mailing list