This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes How to Stop a Thread....... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "How to Stop a Thread......." Watch "How to Stop a Thread......." New topic
Author

How to Stop a Thread.......

kanthi kiran
Greenhorn

Joined: Apr 04, 2008
Posts: 12
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

Joined: Aug 11, 2007
Posts: 4422
    
    2

use mutex or semiphores.
java.util.concurrent.*
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16690
    
  19

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Stop a Thread.......
 
Similar Threads
Threads
How to kill a user thread forcefully?
Daemon thread
Question 18 - Dan's thread mock exam
deamon