Can I use ISchedulingRule as a explicit lock? [message #913091] |
Fri, 14 September 2012 18:59 |
jin lan Messages: 3 Registered: September 2012 |
Junior Member |
|
|
If I have this code:
class Sample{
private Object _lock=new Object();
public void someMethod(){
synchronized(_lock){
doSomething();
}
}
}
Then I wanna use it in this way:
class Sample{
private ISchedulingRule _lock=new SomeSchedulingRule();
public void someMethod(){
try{
Job.getManager().beginRule(_lock);
doSomething();
}finally{
Job.getManager().endRule(_lock);
}
}
}
Can I do it? And should I do it?
The most important thing, does IJobManager.beginRule and IJobManager.endRule provide memory visibility?
[Updated on: Fri, 14 September 2012 18:59] Report message to a moderator
|
|
|
Re: Can I use ISchedulingRule as a explicit lock? [message #913128 is a reply to message #913091] |
Fri, 14 September 2012 20:32 |
|
Hi Jin,
repost this question to eclipse.platform forum instead where it will be
rather answered. Jobs API is a part of Eclipse Platform project.
Have a nice day!
Libor
On 09/14/2012 08:59 PM, jin lan wrote:
> If I have this code:
>
>
>
> class Sample{
> private Object _lock=new Object();
> public void someMethod(){
> synchronized(_lock){
> doSomething();
> }
> }
> }
>
>
>
> Then I wanna use it in this way:
>
>
>
> class Sample{
> private ISchedulingRule _lock=new SomeSchedulingRule();
> public void someMethod(){
> try{
> Job.getManager().beginRule(_lock);
> doSomething();
> }finally{
> Job.getManager().endRule(_lock);
> }
> }
> }
>
>
>
> Can I do it? And should I do it?
> The most important thing does IJobManager.beginRule and
> IJobManager.endRule provide memory visibility?
>
|
|
|
Powered by
FUDForum. Page generated in 0.02969 seconds