Пример #1
0
 @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
  @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();
  }