コード例 #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();
  }