[Haskell-cafe] Concurrent reads, ordered writes?

amindfv at gmail.com amindfv at gmail.com
Fri Sep 6 19:00:21 UTC 2019


I've implemented a solution for this problem, but it seems a bit less clean than it could be, which leaves me wondering if there's a data structure or algorithm specifically for this purpose:

We've got multiple concurrent thereads reading items from a (TBQueue A), calling f :: A -> B, and writing to a (TBQueue B). We must, though, write items into the (TBQueue B) in the order that the corresponding As were read (the order they were put in the (TBQueue A)).

Are there existing libraries which solve this or a similar problem? Ideally with niceties like configuring whether the pending out-of-order writes block the worker threads, and a way of signalling there's no more work to perform.

Thanks!
Tom





More information about the Haskell-Cafe mailing list