Is it a good idea to create your worker threads with a lower priority
than that of the UI thread to get a more responsive UI. I think that's
what you are supposed to do in Swing (with UI thread priority 6) at least.

Don't tweak the thread priorities unless you find a very good reason to do
do---let the subsystem handle it for you. You should bare in mind that the
UI thread is typically idle most of its time anyway, so all of your efforts
might be doomed to be pointless and in vane anyways.

Philip Köster wrote:
> Don't tweak the thread priorities unless you find a very good reason to do
> do---let the subsystem handle it for you. You should bare in mind that the
> UI thread is typically idle most of its time anyway, so all of your efforts
> might be doomed to be pointless and in vane anyways.

This was what I had in mind. The java.util.concurrent package creates
threads with lower priority than Swing's UI thread (i.e. 5) but since we
(by using SWT) run our own UI thread with priority 5 instead of 6 we get
the problems associated with inheriting the UI thread's priority anyway.

Although SWT doesn't do this, the Eclipse workbench does increase the UI
thread's priority by one (see Workbench.createDisplay). So, if you're
writing a plugin to the Eclipse platform, you can follow the convention
of setting your background threads to NORM_PRIORITY. The Eclipse jobs
API (org.eclipse.core.runtime.jobs) does this for all worker threads it
creates.
--

Johan Tibell wrote:
> Michael Forster wrote:
>
>>
>> I think this is a case of a good reason:
>>
>> http://java.sun.com/developer/JDCTechTips/2005/tt0727.html#1
>>
>> MIke
>
>
> This was what I had in mind. The java.util.concurrent package creates
> threads with lower priority than Swing's UI thread (i.e. 5) but since we
> (by using SWT) run our own UI thread with priority 5 instead of 6 we get
> the problems associated with inheriting the UI thread's priority anyway.
>
> - Johan

John Arthorne wrote:
> Although SWT doesn't do this, the Eclipse workbench does increase the UI
> thread's priority by one (see Workbench.createDisplay). So, if you're
> writing a plugin to the Eclipse platform, you can follow the convention
> of setting your background threads to NORM_PRIORITY. The Eclipse jobs
> API (org.eclipse.core.runtime.jobs) does this for all worker threads it
> creates.
> --