Answer to previous exercise about m_fRecursing

Raymond Chen

Answer to previous exercise: The m_fRecursing flag does not need to be per-instance. It only needs to be valid long enough that the recursive call that comes immediately afterwards can be detected. However, a global variable would not work because two threads might be inside the recursive DefDlgProc call simultaneously. But a thread-local variable would work. (If you prefer to code in plain C or don’t want to use classes, you may find this alternative easier to work with.)


Discussion is closed.

Feedback usabilla icon