Using a background thread and working with its private data is not difficult, but safely bringing information retrieved or elaborated by the thread back to the main thread to show it to the user (as you know, only the main thread can handle the GUI in VCL, as well as in FireMonkey) can be a daunting task. An even more complex task would be establishing a generic communication between two or more background threads. In this recipe, you'll see how a background thread can talk to the main thread in a safe manner using the TThreadedQueue<T> class. The same concepts are valid for communication between two or more background threads.
Talking with the main thread using a thread-safe queue
Getting ready
Let's talk...