Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

two questions about rev 7778, the change of class browser build thread

(1/1)

ollydbg:
Hi, Morten.
Q1:
I see the classbrowser.cpp, in function void ClassBrowser::ThreadedBuildTree(cbProject* activeProject)
Why do you first pause the thread, then post the semaphore, and finally resume the thread?
Why not just post the semaphore directly as before rev 7778? I don't think the pause of the thread is necessary.


Q2:
You add the comment in the plugins\codecompletion\classbrowserbuilderthread.cpp

--- Code: ---    // Initialisation is done after Init() and at least *one* call to BuildTree().
    // Also, in Init() m_InitDone is set to false, directly followed by a
    // re-launch of the thread resulting in a call to BuildTree() due to
    // posting the semaphore from ClassBrowser.
    m_InitDone = true;

--- End code ---
But I don't see the m_InitDone will changed to false later. In-fact this variable was initialized as false value, and once it was set to true, it never changed to false. Can you explain?

Thanks.




MortenMacFly:

--- Quote from: ollydbg on May 11, 2014, 05:05:50 am ---Why not just post the semaphore directly as before rev 7778? I don't think the pause of the thread is necessary.

--- End quote ---
I don't recall exactly, but IMHO the pause fixed a crash. You can try what happens if you remove it. Especially when you close/re-open projects.


--- Quote from: ollydbg on May 11, 2014, 05:05:50 am ---    m_InitDone = true;
But I don't see the m_InitDone will changed to false later. In-fact this variable was initialized as false value, and once it was set to true, it never changed to false. Can you explain?

--- End quote ---
...simply because the one-time initialisation has finished?

Navigation

[0] Message Index

Go to full version