Skip to main content



      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 02:03 Go to next message
Eclipse UserFriend
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??

[Updated on: Thu, 27 May 2010 08:09] by Moderator

Re: Why having a single thread for display, so important? [message #536157 is a reply to message #536107] Thu, 27 May 2010 05:32 Go to previous messageGo to next message
Eclipse UserFriend
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 06:14 Go to previous messageGo to next message
Eclipse UserFriend
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....

[Updated on: Thu, 27 May 2010 06:20] by Moderator

Re: Why having a single thread for display, so important? [message #536425 is a reply to message #536169] Fri, 28 May 2010 03:37 Go to previous message
Eclipse UserFriend
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: Mon Jul 07 08:17:51 EDT 2025

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

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

Back to the top