
2011/7/6 Donn Cave
Quoth =?ISO-8859-1?Q?G=E1bor_Lehel?=
, ... Stated another way: I suspect most GUI libraries don't really actually care that you only execute GUI code from the main OS thread, as much as they care that only one (thread-unsafe) GUI function is being called at any given time. If you only ever call GUI code from the same (main) OS thread, that fulfills this requirement, because an OS thread is only capable of running one library function at a time; alternately, if you only ever call GUI code from the same Haskell thread, that also fulfills this requirement, because one Haskell thread is also only capable of running one library function at a time,
I thought in the present case, the program now works when compiled, but fails when run in GHCi, and we believe that the only difference here is that GHCi took the main thread and put the program, and hence the GUI, in some other thread?
I.e., your requirement is indeed met, per the second alternative, but the program still fails, because this library really does need to execute in the initial "main" program thread.
Hmm. That does seem like a pretty strong "disproof". I wonder if my hypothesis is wrong in general, or if this particular library does in fact have other requirements (thread-local storage or such) (and in this case whether my other assumption was wrong and this is actually the usual case), or if there's something else we're missing.
Donn
-- Work is punishment for failing to procrastinate effectively.