[Haskell-cafe] a question about concurrent haskell
dons at galois.com
Thu Sep 18 15:35:47 EDT 2008
> I have a question about concurrent Haskell in GHC.
> Suppose I want to write a native pure Haskell PostgreSQL client.
> I have done this for Python (using Twisted):
> and I would like to do this in Haskell, as an exercise.
> The main problem is with multiple concurrent queries to the same
> connection, from multiple threads.
> PostgreSQL supports multiple requests but it's better to execute only
> one request at a time:
> In the Twisted version I queue all the requests, and every time a
> request completes I call the callback associated with the request and
> execute the next available request.
I'd queue or sychronise all threads requesting the underlying
non-thread safe resource by using either STM transactions, or an MVar.
More information about the Haskell-Cafe