Other Techniques for Sharing Memory

From RAD Studio
Jump to: navigation, search

Go Up to Avoiding Simultaneous Access


When using VCL objects, use the main thread to execute your code. Using the main thread ensures that the object does not indirectly access any memory that is also used by VCL objects in other threads. See Using the Main VCL Thread for more information on the main thread.

If the global memory does not need to be shared by multiple threads, consider using thread-local variables instead of global variables. By using thread-local variables, your thread does not need to wait for or lock out any other threads. See Using Thread-local Variables for more information about thread-local variables.

See Also