Program: 76082
Project: 76082
Buggy source:
/** 
 * Suspend the calling thread until a deadlock or request for topology changes is detected. On resuming, process the requests for topology changes if any, or handle the various deadlocks appropriately. If requested, process the queued topology change requests. Registered topology listeners are informed of each change in a series of calls after successful completion of each request. If any queued request fails, the request is undone, and no further requests are processed. Note that change requests processed successfully prior to the failed request are <i>not</i> undone. Initialize any new actors created, create receivers for them, initialize the receivers and create new threads for the new actors created. After all threads are created, resume the execution and start the threads for the newly created actors. If the resumption was on detection of a deadlock, break the deadlock if possible. If the deadlock is an artificial deadlock, then select the receiver with the smallest queue capacity on which any process is blocked on a write and increment the capacity of the contained queue. If the capacity is non-negative, then increment the capacity by 1. Otherwise set the capacity to 1. Unblock the process blocked on this receiver. Notify the thread corresponding to the blocked process. If the deadlock detected is a real deadlock, then do nothing. This method is synchronized on the director. This method is normally called by the directing thread.
 * @exception IllegalActionException If any of the called methods throwit.
 */
public void fire() throws IllegalActionException {
  Workspace worksp=workspace();
synchronized (this) {
    _mutationBlockCount=0;
    _mutationsRequested=false;
    while ((_readBlockCount != _getActiveActorsCount()) && !_areActorsStopped()) {
      while (!_areActorsDeadlocked() && !_areActorsStopped()) {
        worksp.wait(this);
      }
      if (!_areActorsStopped()) {
        _notDone=_resolveDeadlock();
      }
    }
  }
  return;
}

Fixed version (ground truth):
/** 
 * Suspend the calling thread until a deadlock or request for topology changes is detected. On resuming, process the requests for topology changes if any, or handle the various deadlocks appropriately. If requested, process the queued topology change requests. Registered topology listeners are informed of each change in a series of calls after successful completion of each request. If any queued request fails, the request is undone, and no further requests are processed. Note that change requests processed successfully prior to the failed request are <i>not</i> undone. Initialize any new actors created, create receivers for them, initialize the receivers and create new threads for the new actors created. After all threads are created, resume the execution and start the threads for the newly created actors. If the resumption was on detection of a deadlock, break the deadlock if possible. If the deadlock is an artificial deadlock, then select the receiver with the smallest queue capacity on which any process is blocked on a write and increment the capacity of the contained queue. If the capacity is non-negative, then increment the capacity by 1. Otherwise set the capacity to 1. Unblock the process blocked on this receiver. Notify the thread corresponding to the blocked process. If the deadlock detected is a real deadlock, then do nothing. This method is synchronized on the director. This method is normally called by the directing thread.
 * @exception IllegalActionException If any of the called methods throwit.
 */
public void fire() throws IllegalActionException {
  Workspace worksp=workspace();
synchronized (this) {
    _mutationBlockCount=0;
    _mutationsRequested=false;
    while (_readBlockCount != _getActiveActorsCount()) {
      while (!_areActorsDeadlocked()) {
        worksp.wait(this);
      }
      _notDone=_resolveDeadlock();
    }
  }
  return;
}