I currently make the user twiddle thumbs as this happens, but want to make the process a background task. Sometimes the task returns info in a string in memory.
I see 2 possible solutions:
- A: Open a new (hidden) window
- B: Use a thread.
The thread is handed a pointer to a structure containing info with needed information, and some elements are for return values.
All the elements/fields in the the structure are long integers.
Some of the elements going in will be pointers to memory blocks (used instead of strings) and some of the information collected by the threaded code will be stored in new memory blocks and the addresses stored in the structure.
Would this be safe?
When the thread ends and exits, are any thread-created memory blocks automatically freed? That is, do I need to have the thread hang around until the main app has had a chance to grab the info?
Which would be better in your opinion, window or thread?
A PS: Can file-mapping created by the parent be used by a thread? Or by the second window? (I think file mapping is the term - when a file is bulk loaded into memory and then processed from memory.)
Thanks!
