示例#1
0
文件: Monitor.java 项目: epernia/HVM
 @IcecapCompileMe
 @Override
 public void unlock() {
   clock.disable();
   ManagedEventHandler handler = PriorityScheduler.instance().current.target;
   if (owner == handler) {
     synchCounter--;
     if (synchCounter == 0) {
       owner = null;
       handler.priority.setPriority(priority);
       clock.enable();
       clock.handle();
     }
   } else {
     clock.enable();
     throw new IllegalMonitorStateException("Not owner on exit");
   }
 }
示例#2
0
文件: Monitor.java 项目: epernia/HVM
  @IcecapCompileMe
  @Override
  public void lock() {
    clock.disable();
    ManagedEventHandler handler = PriorityScheduler.instance().current.target;
    if (owner == null) {
      owner = handler;
    }

    if (owner == handler) {
      synchCounter++;
      if (synchCounter == 1) {
        priority = handler.priority.getPriority();
        handler.priority.setPriority(max(priority, ceiling) + 1);
      }
    } else {
      clock.enable();
      throw new IllegalMonitorStateException("Not owner on entry");
    }
    clock.enable();
  }