-1

It is said that Code that will be executed by the event handling thread should be relatively brief. Any specific reason?

This is question talks about the event handling thread in GUI

Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
  • 1
    Where is that citation from? You will probably need to provide a little more context. – Rob Hruska Mar 31 '11 at 18:35
  • 2
    I imagine it's to keep the event handling thread responsive. If you have long processes running in that thread, it'll lock the user out of your program's UI until the processes finish. – Sam Dufel Mar 31 '11 at 18:37
  • See the answer of your previous question http://stackoverflow.com/questions/5498991/swing-toolkit-and-multithreading/5499049#5499049. Also go through the mentioned links. – Favonius Mar 31 '11 at 18:38
  • Sure it is about event handling thread in GUI – Suhail Gupta Mar 31 '11 at 18:38

1 Answers1

1

Assuming this is about the event handling thread in a GUI, then it should be brief because otherwise the application will appear unresponsive. The event thread handles redraws and so on, so if you spend time doing something else the application may not repaint in a timely fashion.

Jeff Foster
  • 43,770
  • 11
  • 86
  • 103
  • @ Jeff Foster Why unresponsive? `application will appear unresponsive. The eve...` – Suhail Gupta Mar 31 '11 at 18:45
  • The event thread reacts to user events. If you are stopping it by writing long running code it can't react and therefore the application looks as if it isn't doing anything. – Jeff Foster Apr 01 '11 at 05:47