Re: [Haskell-cafe] Concurrency best practices?

2011-02-06 Thread Sterling Clover
On Feb 5, 2011, at 2:37 PM, Evan Laforge wrote: I recall reading that clojure has a concept of associative combination. If you can declare that certain operations are associative then the runtime doesn't have to care if they get out of order. I think that you're thinking about the commute

[Haskell-cafe] Concurrency best practices?

2011-02-05 Thread wren ng thornton
So I'm working on a project that uses STM to run a lot of things in parallel without the headaches of locks. So far it's working beautifully, STM rocks. But there's one snag... Sometimes I need those threads to do some IO like printing logging info. I'd like to make these IO chunks atomic

Re: [Haskell-cafe] Concurrency best practices?

2011-02-05 Thread Sebastian Fischer
Hi Wren, maybe Twilight STM is for you: http://hackage.haskell.org/package/twilight-stm Sebastian On Sat, Feb 5, 2011 at 6:46 PM, wren ng thornton w...@freegeek.org wrote: So I'm working on a project that uses STM to run a lot of things in parallel without the headaches of locks. So far it's

Re: [Haskell-cafe] Concurrency best practices?

2011-02-05 Thread Annette Bieniusa
Hi Wren, I am maintaining Twilight STM, and it seems that it might indeed solve your problem. We also use it for logging, locks, and other advanced STM stuff like inconsistency repair. If you are interested, let me know. There is a new version coming up soon, with new features and improved

Re: [Haskell-cafe] Concurrency best practices?

2011-02-05 Thread Jesper Louis Andersen
On Sat, Feb 5, 2011 at 10:46, wren ng thornton w...@freegeek.org wrote: Sometimes I need those threads to do some IO like printing logging info. Logging is easy, especially if you don't mind a performance hit. Create an STM.TChan and throw each log message on it. Have a separate forkIO'ed

Re: [Haskell-cafe] Concurrency best practices?

2011-02-05 Thread aditya siram
There's the stm-io-hooks [1] package but it looks like it hasn't been updated in a while. -deech [1]http://hackage.haskell.org/package/stm-io-hooks On Sat, Feb 5, 2011 at 3:46 AM, wren ng thornton w...@freegeek.org wrote: So I'm working on a project that uses STM to run a lot of things in

Re: [Haskell-cafe] Concurrency best practices?

2011-02-05 Thread Andrew Coppin
On 05/02/2011 12:56 PM, Jesper Louis Andersen wrote: On Sat, Feb 5, 2011 at 10:46, wren ng thorntonw...@freegeek.org wrote: Sometimes I need those threads to do some IO like printing logging info. Logging is easy, especially if you don't mind a performance hit. Create an STM.TChan and throw

Re: [Haskell-cafe] Concurrency best practices?

2011-02-05 Thread Jesper Louis Andersen
On Sat, Feb 5, 2011 at 17:13, Andrew Coppin andrewcop...@btinternet.com wrote: On 05/02/2011 12:56 PM, Jesper Louis Andersen wrote: Presumably messages added to the channel appear immediately after the transaction commits. The problem is, I think GHC's STM implementation might mean that if

Re: [Haskell-cafe] Concurrency best practices?

2011-02-05 Thread Evan Laforge
On Sat, Feb 5, 2011 at 8:19 AM, Jesper Louis Andersen jesper.louis.ander...@gmail.com wrote: On Sat, Feb 5, 2011 at 17:13, Andrew Coppin andrewcop...@btinternet.com wrote: On 05/02/2011 12:56 PM, Jesper Louis Andersen wrote: Presumably messages added to the channel appear immediately after