Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
rev 7747 question: critical section enter and leave?
ollydbg:
Here, code: in classbrowser.cpp line 726
--- Code: ---
THREAD_LOCKER_ENTER(s_TokensTreeCritical);
s_TokensTreeCritical.Enter();
THREAD_LOCKER_ENTERED(s_TokensTreeCritical);
THREAD_LOCKER_LEAVE(s_TokensTreeCritical);
s_TokensTreeCritical.Leave();
--- End code ---
Why?
MortenMacFly:
--- Quote from: ollydbg on February 01, 2012, 07:09:34 am ---Here, code: in classbrowser.cpp line 726
--- Code: ---
THREAD_LOCKER_ENTER(s_TokensTreeCritical);
s_TokensTreeCritical.Enter();
THREAD_LOCKER_ENTERED(s_TokensTreeCritical);
THREAD_LOCKER_LEAVE(s_TokensTreeCritical);
s_TokensTreeCritical.Leave();
--- End code ---
Why?
--- End quote ---
You found a bug, it should be:
--- Code: ---
THREAD_LOCKER_LEAVE(s_TokensTreeCritical);
s_TokensTreeCritical.Leave();
--- End code ---
Copy and paste error. :-(
oBFusCATed:
Can I express my opinion that this macros are super ugly. Why don't you convert them to single lines?
Something like:
--- Code: ---#define CB_LOCKER_ENTER(lock) \
THREAD_LOCKER_ENTER(lock); \
lock.Enter(); \
THREAD_LOCKER_ENTERED(lock);
#define CB_LOCKER_LEAVE(lock) \
THREAD_LOCKER_LEAVE(lock); \
lock.Leave();
--- End code ---
MortenMacFly:
--- Quote from: oBFusCATed on February 01, 2012, 09:32:12 am ---Can I express my opinion that this macros are super ugly. Why don't you convert them to single lines?
--- End quote ---
That would be the next logical step, but it got too late yesterday and actually I wasn't aware that they are REALLY all over the place. :-( And BTW: This affects not only critical sections, but also mutexes and semaphores.
thomas:
I probably should not ask, but why lock/unlock manually at all when there's locker objects for that?
Navigation
[0] Message Index
[#] Next page
Go to full version