internal bool ShouldCreateReport(LatencyDetectionContext currentContext, LoggingType loggingType, out LatencyDetectionContext trigger, out LatencyReportingThreshold thresholdToCheck, out ICollection <LatencyDetectionContext> dataToLog) { bool flag = false; dataToLog = null; thresholdToCheck = null; trigger = null; if (Thread.VolatileRead(ref this.creatingReport) == 0) { LatencyDetectionLocation location = currentContext.Location; BackLog backLog = location.GetBackLog(loggingType); thresholdToCheck = location.GetThreshold(loggingType); flag = backLog.AddAndQueryThreshold(currentContext); if (flag) { flag = (Interlocked.CompareExchange(ref this.creatingReport, 1, 0) == 0); if (flag) { try { flag = backLog.IsBeyondThreshold(out trigger); if (flag) { dataToLog = this.MoveBacklogDataToReport(loggingType); } } finally { Thread.VolatileWrite(ref this.creatingReport, 0); } } } } return(flag); }