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

rev 7747 question: critical section enter and leave?

<< < (2/4) > >>

ollydbg:

--- Quote from: thomas on February 01, 2012, 11:56:05 am ---I probably should not ask, but why lock/unlock manually at all when there's locker objects for that?

--- End quote ---
I guess this way, we can log the information in both entering and leave the critical section stage. The locker scheme can only log the entering info.

oBFusCATed:

--- Quote from: ollydbg on February 01, 2012, 01:03:13 pm ---The locker scheme can only log the entering info.

--- End quote ---
Wrong, no one stops you writing another wrapper for the Locker class :)
Or you can just write you own version of it: call enter in the constructor and leave in the destructor.

MortenMacFly:

--- Quote from: thomas on February 01, 2012, 11:56:05 am ---I probably should not ask, but why lock/unlock manually at all when there's locker objects for that?

--- End quote ---
Because I want to track the error in return and want to have a specific protocol.

MortenMacFly:

--- Quote from: oBFusCATed on February 01, 2012, 01:08:49 pm ---Or you can just write you own version of it: call enter in the constructor and leave in the destructor.

--- End quote ---
Yes, but I also would like to explicitly SEE in the code where session are entered and where they are left for clarity. Actually I am doing this to trace a deadlock. In the end it will be very simple.

thomas:
Well it's too late for that after you've spent many hours... but I would just have made my own locker class identical to the original wxMutexLocker with logging added in constructor and destructor, and added a #define wxMutexLocker myLoggingMutexLocker when desired. When exactly the section is entered and left is clear: enter when the locker object is created, leave when the scope ends (next closing curly brace).

Good luck on finding the deadlock though, this is some nasty work.  :(

Why are there so many locks/unlocks anyway? I counted 85 in the 3 CC files, that seems like an awful lot. I've never really touched code completion because it always scared me off... but naively thought, wouldn't one normally want to parse one complete file at a time (in N threads), and only lock/unlock the shared data structure to flush in all newly parsed tokens once after finishing each file? Something like that?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version