The TThread class (unit System.Classes) is a wrapper around the concept of the thread object. The idea is you can inherit your own class using the TThread class as a parent and then provide a custom implementation of the Execute method. The code you put in the Execute method will be executed in a separate thread. You only need to create an instance of your new class and start it by using the TThread.Start method.
Shared resources are always problematic when it comes to parallel (multi-threaded) programming. AÂ common scenario is to define your TThread inherited class, onboarding all necessary data as class members (fields or properties). Before starting the thread (yet after creating the instance), you need a chance to provide values for these fields or properties.
The running thread will make use of these values without worrying about concurrency issues or synchronization requirements. Obviously, this is easy to do for primitive...