pipes-concurrent — adding broadcast clients

60 views
Skip to first unread message

Dima Gorbik

unread,
Mar 21, 2015, 4:20:06 PM3/21/15
to haskel...@googlegroups.com
Hello,

I am facing the following problem — I need to add broadcast clients dynamically. Monoidal concatenation only allows to specify these clients statically. Theoretically I could have a dispatching pipe that would operate on a number of boxes for all clients but then how would I add new boxes to the dispatcher dynamically without restarting the whole pipe. What's the best way to implement this?

Thanks,
Dima

Daniel Díaz

unread,
Mar 23, 2015, 3:29:22 AM3/23/15
to haskel...@googlegroups.com
Hi, 

Perhaps you could put the list (or map) of boxes in an MVar (or TVar) and make the dispatching pipe check the MVar at each iteration.

Gabriel Gonzalez

unread,
Mar 29, 2015, 7:54:40 PM3/29/15
to haskel...@googlegroups.com, sock...@gmail.com
One thing you can do is to `spawn` a new mailbox and then write any messages intended for a dynamic number of listeners to that mailbox.  Any time you want to create a new listener just fork a thread for that listener and have it listen to that mailbox's `Input`.
--
You received this message because you are subscribed to the Google Groups "Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-pipe...@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages