/// <summary> /// This method should be called prior to using this class /// </summary> internal static CompletionCode Init() { CompletionCode completionCode = CompletionCode.CommDevFailedToInit; // populdate Blade_En State Cache. foreach (byte Id in physicalServerIdTable) { CachedBladePowerStatus.Add(Id, new BladeEnState()); } // Clear this flag in case that CM retries to initialize isTerminating = false; // Enforce that the update to the flag variable is visible to other threads orderly Thread.MemoryBarrier(); portManagers = new PortManager[numPorts]; for (int i = 0; i < numPorts; i++) { portManagers[i] = new SerialPortManager(i, numPriorityLevels); completionCode = portManagers[i].Init(); if (CompletionCodeChecker.Failed(completionCode) == true) { Tracer.WriteError("Failed to initialize portManager: {0} Logical Id: {1}", i, PortManager.GetPhysicalPortNameFromLogicalId(i)); Release(); return completionCode; } } return completionCode; }
/// <summary> /// This method should be called prior to using this class /// </summary> static internal CompletionCode Init() { CompletionCode completionCode = CompletionCode.CommDevFailedToInit; // Clear this flag in case that CM retries to initialize isTerminating = false; // Safe mode is disabled by default when initialized isSafeModeEnabled = false; // Enforce that the update to the flag variable is visible to other threads orderly Thread.MemoryBarrier(); portManagers = new PortManager[numPorts]; for (int i = 0; i < numPorts; i++) { portManagers[i] = new SerialPortManager(i, numPriorityLevels); completionCode = portManagers[i].Init(); if (CompletionCodeChecker.Failed(completionCode) == true) { Tracer.WriteError("Failed to initialize portManager: {0} Logical Id: {1}", i, PortManager.GetPhysicalPortNameFromLogicalId(i)); Release(); return completionCode; } } return completionCode; }