I have a thread running as part of a program that I need to keep running through the duration of my program. However, as I run the program, I want to be able to periodically show what data is being processed on the thread (without stopping it).
Conceptually, is that possible and/or good practice? From what I have been reading about threads, it seems like in order to access a thread, you have put it to sleep, see what you want, and then start it again. Is there a way to "mirror" that thread? Even if I can do that, is that good practice to access a thread directly, or do I need to dump the information to a data structure first and then read it?
Extra Information:
I am not sure if this makes a difference, but I created a thread using the C++ CreateThread function. I was just reading in another post that there was a memory leak problem with that method. However, I thought that HOW I create the thread changes the level of the OS it is working on and might affect whether or not I was able to access the thread or not.
Thanks for any advice in advance!