STM interfacing with GLFW

Hi, I'm new to STM and to Haskell in general. I've been writing a small library to try some graphics algorithms in Haskell, but using GLFW's callbacks seems to be causing me problems. I have a (relatively heavyweight?) object wrapped in a TVar (Data.Set) that I'm sharing across all threads. Unfortunately, once I run the program, it becomes unresponsive although the main loop is still running. I'm not sure exactly what the semantics are for getting STM right, but ideally I'm trying to modify the TVar in GLFW event callbacks and then finally read out the value of the TVar at the end (or beginning) of my rendering loop. I've been able to get a small program working that reproduces my problem: https://gist.github.com/Mokosha/34eda7bd2d6b5cafd5a3 Any help would be great! Thanks! - Pavel

Turns out this was a bug from removing the GLFW.pollEvents call, rather
than anything having to do with STM. Sorry for the spam!
- Pavel
On Sat, Dec 7, 2013 at 4:35 PM, Pavel Krajcevski
Hi,
I'm new to STM and to Haskell in general. I've been writing a small library to try some graphics algorithms in Haskell, but using GLFW's callbacks seems to be causing me problems. I have a (relatively heavyweight?) object wrapped in a TVar (Data.Set) that I'm sharing across all threads.
Unfortunately, once I run the program, it becomes unresponsive although the main loop is still running. I'm not sure exactly what the semantics are for getting STM right, but ideally I'm trying to modify the TVar in GLFW event callbacks and then finally read out the value of the TVar at the end (or beginning) of my rendering loop. I've been able to get a small program working that reproduces my problem:
https://gist.github.com/Mokosha/34eda7bd2d6b5cafd5a3
Any help would be great!
Thanks!
- Pavel
participants (1)
-
Pavel Krajcevski