Re: How to run tasks with priority?
- From: "Boudewijn Dijkstra" <usenet@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 1 Jun 2005 18:54:52 +0200
"George George via JavaKB.com" <forum@xxxxxxxxxx> schreef in bericht
news:00c78c327e394403907c1ce6b436fdd1@xxxxxxxxxxxxx
> Thanks Boudewijn,
>
> Your reply is very helpful! I found that if I use priority feature of Java
> thread, then I can only have (MAX_PRIORITY - MIN_PRIORITY) different
> priorities, which may limit my application. I am wondering whether there
> are any alternate solutions which may have more different priorities.
It sounds like you need to use synchronization, not priorities. With
synchronized{} blocks you can make threads wait for eachother at fixed points.
>> You can accomplish this behaviour with the Thread#yield
>> () method.
>
> How can I utilize utilize yield? Could you please give me a simple sample?
If two threads have the same priority and execute the same code, adding a
yield call to one of those, could make it run about twice as slow.
.
- Follow-Ups:
- Re: How to run tasks with priority?
- From: George George via JavaKB.com
- Re: How to run tasks with priority?
- References:
- Re: How to run tasks with priority?
- From: George George via JavaKB.com
- Re: How to run tasks with priority?
- Prev by Date: Re: report generation in java
- Next by Date: need to implement a proxy gateway in Java...
- Previous by thread: Re: How to run tasks with priority?
- Next by thread: Re: How to run tasks with priority?
- Index(es):
Relevant Pages
|