News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

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

Started by ollydbg, May 11, 2014, 05:05:50 AM

Previous topic - Next topic

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

   // 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.




If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

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.
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?
...simply because the one-time initialisation has finished?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]