<div dir="ltr">Turns out this was a bug from removing the GLFW.pollEvents call, rather than anything having to do with STM. Sorry for the spam!<div><br></div><div>- Pavel</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sat, Dec 7, 2013 at 4:35 PM, Pavel Krajcevski <span dir="ltr"><<a href="mailto:krajcevski@gmail.com" target="_blank">krajcevski@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">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. </div>

<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">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:</div>

<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><a href="https://gist.github.com/Mokosha/34eda7bd2d6b5cafd5a3" target="_blank">https://gist.github.com/Mokosha/34eda7bd2d6b5cafd5a3</a><br>

</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Any help would be great!</div><div style="font-family:arial,sans-serif;font-size:13px"><br>

</div><div style="font-family:arial,sans-serif;font-size:13px">Thanks!</div><span class="HOEnZb"><font color="#888888"><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
- Pavel</div></font></span></div>
</blockquote></div><br></div>