refactor: Refactor DeviceManager and related classes to improve thread safety and performance

- Replaced CCriticalSection with lock statements in DeviceManager for better thread management.
- Updated AddDevice and RemoveDevice methods to use Monitor for locking.
- Enhanced event handling for device activation and registration.
- Modified FileIO class to utilize Task for asynchronous file operations instead of CrestronInvoke.
- Improved feedback mechanisms in FeedbackBase and SystemMonitorController using Task.Run.
- Refactored GenericQueue to remove Crestron threading dependencies and utilize System.Threading.
- Updated BlueJeansPc and VideoCodecBase classes to use Task for asynchronous operations.
- Cleaned up unnecessary critical sections and improved code documentation across various files.
This commit is contained in:
Neil Dorin 2026-03-10 17:30:59 -06:00
parent 426ef4ad6b
commit 346a5e9e57
23 changed files with 998 additions and 912 deletions

View file

@ -26,8 +26,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
protected VideoCodecBase Codec { get; private set; }
/// <summary>
///
/// </summary>
@ -126,7 +124,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
//state.CurrentDirectory = PrefixDirectoryFolderItems(directory);
state.CurrentDirectory = directory;
CrestronInvoke.BeginInvoke((o) => PostStatusMessage(state));
Task.Run(() => PostStatusMessage(state));
}
}
catch (Exception ex)
@ -162,7 +160,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary>
/// Called from base's RegisterWithAppServer method
/// </summary>
/// <param name="appServerController"></param>
protected override void RegisterActions()
{
try
@ -786,6 +783,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
}
/// <summary>
/// Sends the full status of the codec, including active calls, camera status, and directory info if applicable
/// </summary>
/// <param name="id"></param>
protected virtual void SendFullStatus(string id = null)
{
if (!Codec.IsReady)