Now, how does it work?
Compile a function into a shared lib. This function can be “forked off” as a thread. Both the “main thread” (your command prompt thread) and the background thread can manipulate the same objects [with some limititations].
Example: The background thread can fill histograms, at the prompt, you can work with your histograms, display them at will, clear them, fit them, store them, whatever -- you get the idea.