Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
parser test rev 7157 error?
Loaden:
One Parser per one thread.
So in here, there has three thread was started.
We use threadpool for batch parsing.
ollydbg:
--- Quote from: Loaden on May 26, 2011, 08:19:28 am ---One Parser per one thread.
So in here, there has three thread was started.
We use threadpool for batch parsing.
--- End quote ---
but g_ParserThreadCritical is a global variable, it only allowed one entry.
MortenMacFly:
--- Quote from: ollydbg on May 26, 2011, 08:11:14 am ---Why does the function "Parse" recursively called???
--- End quote ---
Your example is OK. The implementation of ParserTest provides the global variable "g_ParserCritical". As ParserTest is intatiated several times (inspect the addresses in your debug - they differ) the locker is also created multiple times. And that is OK, because the lock shall apply just the one object itself.
Loaden:
--- Quote from: ollydbg on May 26, 2011, 08:20:49 am ---
--- Quote from: Loaden on May 26, 2011, 08:19:28 am ---One Parser per one thread.
So in here, there has three thread was started.
We use threadpool for batch parsing.
--- End quote ---
but g_ParserThreadCritical is a global variable, it only allowed one entry.
--- End quote ---
Right, That's the final want.
ollydbg:
--- Quote from: Loaden on May 26, 2011, 08:19:28 am ---One Parser per one thread.
So in here, there has three thread was started.
We use threadpool for batch parsing.
--- End quote ---
@loaden, In the parsertest.cbp, we do NOT use any kind of threadpool for batch parsing, do we? The parsertest project does not use multithread, does it?
--- Quote from: MortenMacFly on May 26, 2011, 08:46:36 am ---As ParserTest is intatiated several times (inspect the addresses in your debug - they differ) the locker is also created multiple times. And that is OK, because the lock shall apply just the one object itself.
--- End quote ---
Yes, they are many different locker instances, but all the instances use the same "static wxCriticalSection g_ParserThreadCritical;"
I have never known about this is a correct thing before, I will try to learn more things about multi-thread programming.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version