Fix bug where multiple threads modify same variable at the same time. Perform some refactoring
This commit is contained in:
@@ -76,8 +76,8 @@ namespace ProgramLib
|
||||
try
|
||||
{
|
||||
Dictionary<Events, EventWaitHandle> eventDict = new Dictionary<Events, EventWaitHandle>();
|
||||
eventDict[Events.GLOBAL_QUIT] = Program.Instance()._eventManager[EventManager.Events.GLOBAL_QUIT];
|
||||
eventDict[Events.UUT_POWER_ON] = Program.Instance()._eventManager[EventManager.Events.UUT_POWER_ON];
|
||||
eventDict[Events.GLOBAL_QUIT] = Program.Instance().EventManager[EventManager.Events.GLOBAL_QUIT];
|
||||
eventDict[Events.UUT_POWER_ON] = Program.Instance().EventManager[EventManager.Events.UUT_POWER_ON];
|
||||
eventDict[Events.EVENT_TIMED_OUT] = null;
|
||||
|
||||
EventGroup<Events, EventWaitHandle> eventGroup = new EventGroup<Events, EventWaitHandle>(eventDict);
|
||||
@@ -119,8 +119,8 @@ namespace ProgramLib
|
||||
try
|
||||
{
|
||||
Dictionary<Events, EventWaitHandle> eventDict = new Dictionary<Events, EventWaitHandle>();
|
||||
eventDict[Events.GLOBAL_QUIT] = Program.Instance()._eventManager[EventManager.Events.GLOBAL_QUIT];
|
||||
eventDict[Events.UUT_POWER_OFF] = Program.Instance()._eventManager[EventManager.Events.UUT_POWER_OFF];
|
||||
eventDict[Events.GLOBAL_QUIT] = Program.Instance().EventManager[EventManager.Events.GLOBAL_QUIT];
|
||||
eventDict[Events.UUT_POWER_OFF] = Program.Instance().EventManager[EventManager.Events.UUT_POWER_OFF];
|
||||
eventDict[Events.EVENT_TIMED_OUT] = null;
|
||||
|
||||
EventGroup<Events, EventWaitHandle> eventGroup = new EventGroup<Events, EventWaitHandle>(eventDict);
|
||||
@@ -142,7 +142,7 @@ namespace ProgramLib
|
||||
|
||||
if (!ovpTriggeredInPowerSupply && !ocpTriggeredInPowerSupply)
|
||||
{
|
||||
Program.Instance()._powerSupplySharedData.SetData(moduleName, data.Voltage, data.Current, _powerSupplyModuleInfoDict[moduleName]);
|
||||
Program.Instance().PowerSupplySharedData.SetData(moduleName, data.Voltage, data.Current, _powerSupplyModuleInfoDict[moduleName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -225,10 +225,10 @@ namespace ProgramLib
|
||||
/// <returns></returns>
|
||||
private void HandleOutOfToleranceCondition(string errorMsg)
|
||||
{
|
||||
if (!Program.Instance()._eventManager[EventManager.Events.FATAL_FAILURE].WaitOne(0))
|
||||
if (!Program.Instance().EventManager[EventManager.Events.FATAL_FAILURE].WaitOne(0))
|
||||
{
|
||||
Program.Instance().SetFatalErrorMsgFromSupportThread(errorMsg);
|
||||
Program.Instance()._eventManager[EventManager.Events.FATAL_FAILURE].Set();
|
||||
Program.Instance().EventManager[EventManager.Events.FATAL_FAILURE].Set();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user