Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript 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: 4686
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: 23275
125
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!