// Checks data dependency with other delayed actions // because this is a synchronization action, it should // conflict with all other synchronization action else // we can produce deadlock public override bool DoesConflict(DelayedAction da) { if(da is DelayedLock) { DelayedLock dl = (DelayedLock)da; if(dl.obj == this.obj) return true; } else if(da is DelayedUnlock) { DelayedUnlock du = (DelayedUnlock)da; if(du.obj == this.obj) return true; } else if(da is DelayedWait) { if(((DelayedWait)da).obj == this.obj) return true; } else if(da is DelayedPulse) { if(((DelayedPulse)da).obj == this.obj) return true; } return false; }
public override bool DoesConflict(DelayedAction da) { if(da is DelayedWrite) { DelayedWrite dw = (DelayedWrite)da; if((dw.Destination == this.srcValue) || (dw.Destination == this.destValue)) return true; if((dw.Source == this.destValue)) return true; return false; } else if(da is DelayedRead) { DelayedRead dr = (DelayedRead)da; if((dr.Destination == this.srcValue) || (dr.Destination == this.destValue)) return true; if((dr.Source == this.destValue)) return true; return false; }else return false; }
/// <summary> /// Adds an uncompleted action to the thread queue /// </summary> /// <param name="da">The uncompleted action to be executed later</param> public void AddPendingAction(DelayedAction da) { pendingActions.Add(da); }
public abstract bool DoesConflict(DelayedAction da);
public override bool DoesConflict(DelayedAction da) { throw new Exception("Should not be called"); }