Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Stop a Thread.......  RSS feed

 
kanthi kiran
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

My doubt is........

I have three threads which are going to access the method with different priorities. Is there any way that thread with the lowest priority will be execute first without the mercy of the cpu scheduler... by stopping the other threads to start executing the method.....

Thanks

kanthi kiran
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use mutex or semiphores.
java.util.concurrent.*
 
Henry Wong
author
Sheriff
Posts: 22837
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way that thread with the lowest priority will be execute first without the mercy of the cpu scheduler... by stopping the other threads to start executing the method.....


Officially? No. The methods to temporarally stop a thread (to suspend a thread) are deprecated.

The way to accomplish this is cooperatively. You higher priority threads will need to wait, while the lower priority thread finishes its task first.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!