It wasn't so bad. Here's a patch to make lock()/unlock() methods protected (against mili-branch@618). Also included is an ObjectLocker in the spirit of MutexLocker for auto-unlocking on stack unwind. The few objects that must allow external locking (MAP, INGAME_UNITS, LUA_PROGRAM, etc) are set apart by inheriting from Mutex instead of ObjectSync.<chkno> Question: Why "pMutex.lock()" everywhere instead of "lock()" ?
<milipili> I would like to avoid lock() the most possible. A class should never be locked from outside
<milipili> It is impossible to find out a dead lock in this kind of design
<chkno> So make lock() a protected method?
<milipili> No it is impossible ... :(
<milipili> Without rewriting a lot/lot/lot/lot of code
Minimize external locking
Minimize external locking
I don't think it is the real good solution. A protected variable is good enough and I would even say that ObjectSync should be completly removed.
It adds a useless interface from my point of view and it does not fully improve the global code design. Unless I missed something.
It adds a useless interface from my point of view and it does not fully improve the global code design. Unless I missed something.
Damien Gerard
Ta3d & Yuni Developer
Ta3d & Yuni Developer
Who is online
Users browsing this forum: No registered users and 17 guests