• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread Priority

 
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If a Thread's priority is not specified explicitly then in gets a priority of Thread.NORM_PRIORITY
True or
False?
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello:
As far as i know, it is false.
A Thread inherited the priority from the Thread which created it. u have to use setPriority() method to define the prioirty,otherwise,it can't get the Thread.NORM_PRIORITY which is 5.
If i am wrong ,hope someone can correct me.
Thanks.
 
Honggui Li
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello:
As far as i know, it is false.
A Thread inherited the priority from the Thread which created it. u have to use setPriority() method to define the prioirty,otherwise,it can't get the Thread.NORM_PRIORITY which is 5.
If i am wrong ,hope someone can correct me.
Thanks.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Honggui Li is correct. You can test if the Thread has defaultpriority
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ragu,
A Thread will inherit the priority of the thread that created it unless you specifically set the new threads priority. So the answer would have to be false. A new thread will not always be set to Thread.NORM_PRIORITY.
If the creator thread's priority has not been explicitly set then chances are it's NORM_PRIORITY as that's the priority assigned to <code>main()</code>

------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
[This message has been edited by Jane Griscti (edited August 16, 2001).]
 
I'm full of tinier men! And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic