public ReturnCode DeleteDataReader(IDataReader dataReader) { DataReader drObj = dataReader as DataReader; ReturnCode result = DDS.ReturnCode.AlreadyDeleted; ReportStack.Start(); lock (this) { if (this.rlReq_isAlive) { if (drObj != null) { if (readerList.Remove(drObj)) { result = drObj.deinit(); if (result != ReturnCode.Ok) { readerList.Add(drObj); } } else { /* The DataReader can be AlreadyDeleted, or it can be from another * Subscriber. Its liveliness cannot be modified without the lock * of its factory, so we are safe checking it here since we hold * the lock to this factory. If the DataReader is from another * Subscriber, then the result may be PRECONDITION_NOT_MET while * it should have been BAD_PARAMETER, but such a Use Case has * an inherent race-condition anyway, and the result of such * a test is by definition undefined. */ if (drObj.rlReq_isAlive) { result = ReturnCode.PreconditionNotMet; ReportStack.Report(result, "DataReader " + drObj + " unknown to Subscriber " + this + "."); } else { // ALREADY_DELETED may only apply to the Subscriber in this context, // so for a deleted datareader use BAD_PARAMETER instead. result = DDS.ReturnCode.BadParameter; ReportStack.Report(result, "DataReader " + drObj + " was already deleted."); } } } else { result = ReturnCode.BadParameter; ReportStack.Report(result, "datareader is invalid (null), or not of type " + "DDS::OpenSplice::DataReader."); } } } ReportStack.Flush(this, result != ReturnCode.Ok); return(result); }