I'm using com interop to talk to some physical piece of hardware.
When I need the current reading from the hardware I have a nice elaborate piece of threading code that keeps it off my UI thread so that I don't lock up the UI while I query the hardware since sometimes it can take as much as 1-2 minutes (although usually more like 1-5 seconds).
So once I step into the com object it bounces back to the main UI thread and the UI becomes busy during the duration of the reading.
The main app is a .net WPF app, so it STA by default. The COM object is created on the main thread, but it's created my a singleton factory, so all of these objects are created by the same few lines of UI.
I'd love to show some code, but it's not like the stuff is in just a few lines of code.
What kind of work arounds are there for this behavior? I'd also love to be able to read from multiple com object simultaneously.
If were to create background threads to spin up these com objects inside my object facotry. How do I keep them alive to handle the work that gets marshaled back to them?