Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ollydbg on May 11, 2014, 05:05:50 am

Title: two questions about rev 7778, the change of class browser build thread
Post by: ollydbg on May 11, 2014, 05:05:50 am
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;
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.




Title: Re: two questions about rev 7778, the change of class browser build thread
Post by: MortenMacFly on May 16, 2014, 07:21:37 am
Why not just post the semaphore directly as before rev 7778? I don't think the pause of the thread is necessary.
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.

   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?
...simply because the one-time initialisation has finished?