View Issue Details

IDProjectCategoryView StatusLast Update
00035503 - Current Dev ListMaintenancepublic2019-11-06 07:48
ReporterK7ZCZAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version6.7 
Target VersionFixed in Version 
Summary0003550: Awkard background thread architecture has dangerous deficiencies
DescriptionRig Control, DM780, and Logbook all use an awkard BackgroundProcessingThread class to manage extra threads to handle actions outside of the UI-owning main thread. The class has an interface that is prone to creating buggy code that's hard to maintain and diagnose, is quite inefficient, and should be re-written.

The notable problems are here:


  • A single REQUEST_SIGNAL_DATA structure is used for all requests. The name of this structure is unrelated to the type of request, which makes the code hard to read or understand.

  • The thread implements several types of requests, but they're all initiated with an instance of that same RSD structure. A more sensible design gives each request its own structure type so that parameters can have descriptive names and accurate types -- no casting back and forth would be necessary.

  • The RSD structure is exposed to outside callers and shouldn't be. Instead, type-safe accessors functions should be used, or even buildable C++ objects so that parameter types and options can be clearly represented.

  • Many instances of the thread class exist, which naturally supports multiple threads and scaling. Each thread instance ends up only handling certain types of requests despite carrying local buffers used for the full set of requests types -- which not all threads will end up servicing. The result is a significant amount of wasted memory.

  • Code switches actions on an enum, then calls member functions of the thread class. A more OO design would hold a queue of polymorphic types (for type safety of the request data), then allow the request type to implement its own servicing function so that requests and their representative data were encapsulated together.



This large item might be attacked at once, but probably can be split into multiple issues for tracking ... at least for each affected application, if not for each work item. The result of fixing this issue will be safer application code, greater code reuse (allowing bug fixes in a single spot rather than hunt-and-repeat), and lower resource usage.
TagsNo tags attached.
ModuleAll
Sub-ModuleFunctional
TestingNot Started

Activities

k8jhd

2019-11-06 07:48

updater   ~0009171

unable to test on my win 10 laptop-k8jhd

Issue History

Date Modified Username Field Change
2019-11-04 08:44 K7ZCZ New Issue
2019-11-06 07:48 k8jhd Note Added: 0009171