| Copyright | (C) 2016-2025 David M. Johnson |
|---|---|
| License | BSD3-style (see the file LICENSE) |
| Maintainer | David M. Johnson <code@dmj.io> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Miso.Concurrent
Contents
Description
Synchronization primitives
Synchronization primitive for event loop
type Mailbox = TChan Mail Source #
Publish / Subscribe concurrency primitive
A Mailbox is a broadcast TChan that can express the following concurrency patterns
- Broadcast (one-to-all, 1:n)
- Multicast (one-to-many, 1:n)
- Unicast (one-to-one, 1:1)
All the above are supported as well in a bidirectional setting.
- Bidirectional (multicast / broadcast / unicast) (n:m)
Practically this pattern resembles cloud notification services like
- Amazon SNS
- Google Pub/Sub
Type for expressing Mail (or message payloads) put into a Mailbox for delivery
cloneMailbox :: Mailbox -> IO Mailbox Source #
Duplicates a Mailbox, all new Mail is sent to all cloned Mailbox.
Messages in the original Mailbox are retained (unlike copyMailbox).