[Haskell-beginners] gtk2hs and threadDelay

Felipe Almeida Lessa felipe.lessa at gmail.com
Mon Dec 26 10:24:20 CET 2011


On Mon, Dec 26, 2011 at 6:37 AM,  <gabre at caesar.elte.hu> wrote:
> I expect this code to do the following: when somebody clicks the button
> "btn" from record gui, the program draws something, and then waits for
> 1800000 microsecs (I hope threadDelay is measured in microsecs), and then
> draws something else. In fact, the code doesnt do this, but waits 1800000+
> microsecs, and draws everything at the same time. Is there an error
> somewhere?

Yes, you should not block the UI thread.  Never.  If you want your
code to behave well, you'll need to do something like adding a timer
that goes off after 1.8s or something like that.  If you keep blocking
your UI thread, you'll have many many headaches.

Cheers,

-- 
Felipe.



More information about the Beginners mailing list