Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Can I use ISchedulingRule as a explicit lock?
Can I use ISchedulingRule as a explicit lock? [message #913224] Fri, 14 September 2012 22:34
jin lan is currently offline 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?
Previous Topic:Broken links on eclipse.org/eclipse/platform-ua site
Next Topic:can't deactivate context on workbench window
Goto Forum:
  


Current Time: Tue Jul 29 13:03:30 EDT 2014

Powered by FUDForum. Page generated in 0.02063 seconds