Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Why having a single thread for display is so important?
Why having a single thread for display is so important? [message #536107] Thu, 27 May 2010 06:03 Go to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
Having a single thread for display has forced me many times to build an application which is multi threaded...

And everybody knows about the problems of a multithreaded application.

So i was wondering is it worth it to have a single threaded display??


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay

[Updated on: Thu, 27 May 2010 12:09]

Report message to a moderator

Re: Why having a single thread for display, so important? [message #536157 is a reply to message #536107] Thu, 27 May 2010 09:32 Go to previous messageGo to next message
Viliam Durina is currently offline Viliam DurinaFriend
Messages: 13
Registered: July 2009
Junior Member
I think this is a limitation of most GUI implementations (at least of windows).

By the way, I don't understand, how single-threaded display forces you to have multiple threads and how multithreaded display would help you avoid having multiple threads. You could ask: I need a dog that likes cats because I don't want to have a cat :)

Viliam

On 27. 5. 2010 8:03, vijay wrote:
> Having a single thread for display has forced me many times to build an
> application which is multi threaded...
>
> And everybody knows about the problems of a multithreaded application.
>
> So i was wondering is it worth it to have a single threaded display??
Re: Why having a single thread for display, so important? [message #536169 is a reply to message #536157] Thu, 27 May 2010 10:14 Go to previous messageGo to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
The dog cat one was a twister....

Now since all the ui updates have to be done thru ui thread and you can not have heavy operations like conversions,retreaval,processing in ui thread ,since it will hang the ui thread....

Hence seperate threads(jobs) for heavy processing and ui updating (by uijob or display.syncExec or display.asyncExec) has to be created...

and since the heavy operation should be able to run in background,hence inevitable it becomes a multi threaded application...
In fact an RCP application is a multithreaded application(pls dont tell me to go to RCP Forum Smile )

Quote:
By the way, I don't understand, how single-threaded display forces you to have multiple threads and how multithreaded display would help you avoid having multiple threads. You could ask: I need a dog that likes cats because I don't want to have a cat Smile



its not about threads its about updating the ui from any thread not restricted by UI thread only....


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay

[Updated on: Thu, 27 May 2010 10:20]

Report message to a moderator

Re: Why having a single thread for display, so important? [message #536425 is a reply to message #536169] Fri, 28 May 2010 07:37 Go to previous message
Viliam Durina is currently offline Viliam DurinaFriend
Messages: 13
Registered: July 2009
Junior Member
Okay, sorry for my invective.

If the background task only needs to update the UI, it could run the processing in the UI thread and call Display.update() regularly. But this might not be possible, if you are not able to call it at least every few seconds. Then you really need separate thread, but the communication can be simple, if the task is relatively independent.

Viliam

On 27. 5. 2010 12:14, vijay wrote:
>
> and since the heavy operation should be able to run in background,hence
> inevitable it becomes a multi threaded application...
> In fact an RCP application is a multithreaded application(pls dont tell
> me to go to RCP Forum :) )
> --
Previous Topic:MenuBar
Next Topic:IStructuredSelection thoughts
Goto Forum:
  


Current Time: Thu Mar 28 16:10:31 GMT 2024

Powered by FUDForum. Page generated in 0.01766 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top