File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setPriority()?

 
Calanthe Wei
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can calling the setPriority method cuase a thread to stop executing?
I am a little confused about the answer. Thank you for your explanation.
 
Jose Botella
Ranch Hand
Posts: 2120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess that if the Thread.MIN_PRIORITY is set, any thread with the biggest priority could be chosen now.
 
Shivaji Marathe
Ranch Hand
Posts: 203
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The results of calling set priorirty on a thread will depend on how the operating system handles threads and priorities and also on other threads that are alive at any given point in time.
Let us say you have only one thread running, you can reduce it's priority all the way to min_priority and it will still continue to run.
Let us say you are running on an OS that implements preemptive scheduling and the current thread is set at priority 5, Let us also say that all other threads that are ready to run are at min_priority. If you reduce the priority of the current thread to 3, it will still continue to run.
You can not predict/guarantee the results of setting priority on a thread.
Hope this helps
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic