RAD Studio |  |

Coordinating Threads
See Also
Collapse All

When writing the code that runs when your thread is executed, you must consider the behavior of other threads that may be executing simultaneously. In particular, care must be taken to avoid two threads trying to use the same global object or variable at the same time. In addition, the code in one thread can depend on the results of tasks performed by other threads.

Whether using thread objects or generating threads using BeginThread, the following topics describe techniques for coordinating threads:

- Avoiding Simultaneous Access
- Waiting for Other Threads
- Using the Main VCL Thread

When 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 Also

Executing Thread Objects

Defining Thread Objects

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!