skydevgit / crisscross

Automatically exported from code.google.com/p/crisscross
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Mutex destructor #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Mutex::~Mutex() should probably only call Unlock() if the Mutex is locked at 
the time of its deletion.

Original issue reported on code.google.com by ARPl...@gmail.com on 18 May 2007 at 6:08

GoogleCodeExporter commented 9 years ago
Agreed, but is there a specific problem that arises from this?

Targeting for v0.6.1

Original comment by steven.n...@gmail.com on 18 May 2007 at 6:46

GoogleCodeExporter commented 9 years ago
It would be better practice, plus there's a chance it might bitch or crash 
because the behaviour is undefined. 
(unlikely but possible)

Original comment by ARPl...@gmail.com on 18 May 2007 at 6:50

GoogleCodeExporter commented 9 years ago
After further research, it seems this doesn't cause any problems. If it arises 
in the
future, I'll reopen this issue.

Original comment by steven.n...@gmail.com on 20 May 2007 at 9:10

GoogleCodeExporter commented 9 years ago
It would have been quicker to just fix it.

Add  bool islocked;  to the class.
In the constructor, initialise islocked to false
On locking, after system call, islocked = true;
On unlocking, before system call, islocked = false;
In destructor, if (islocked) Unlock();

Original comment by ARPl...@gmail.com on 21 May 2007 at 1:02