[Haskell-cafe] Question about concurrency, threads and GC

Joey Adams joeyadams3.14159 at gmail.com
Sat Mar 3 08:05:17 CET 2012


On Fri, Mar 2, 2012 at 7:34 PM, Joey Adams <joeyadams3.14159 at gmail.com> wrote:
> I'll try to put together a simple chat server example, like the one I
> wrote for stm-channelize.

Here it is:

    https://github.com/joeyadams/haskell-chat-server-example

See, in particular, the serveLoop function.  When a message is
received from the client, it is written to the send channel of every
other client.  When a message is written on the client's own send
channel, it is transmitted to the client.  The primary thread for the
client waits until one of the worker threads signals completion, then
kills both of the worker threads.

I hope this example gives you some ideas.

-Joey



More information about the Haskell-Cafe mailing list