### Threads and C++ Class Members

If you use the same C++ class in two different threads, you may have thread problems such as the following:

- If the class contains static variables, you may have re-entrancy problems.
- If you are using the same instance from two separate threads, the instance may be accessed by both threads at once, resulting in a loss of data integrity.

In both cases you need re-entrancy protection. For example, use a semaphore whenever you access the static variables or the common class instance.

Debugging Threads