octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Locking graphics system - GUI/octave synchronization


From: John W. Eaton
Subject: Re: Locking graphics system - GUI/octave synchronization
Date: Sat, 19 Jul 2008 22:59:19 -0400

On 18-Jul-2008, Jaroslav Hajek wrote:

| I guess you have 32-bit int, right? If so, then I think I understand
| the problem:
| when ~octave_mutex() is called on the "pointer" object, and rep->count
| is decremented
| to zero, `delete rep' calls again the same destructor which test
| rep->rep, not rep->count!!
| If only count is initialized and rep is wider, then it is easily
| possible for count to be zero while rep is nonzero.
| The trick of using the same class for both rep and pointer is cute but
| took me some time to understand ;)

Ah, you're right.  As I recall, this design is presented Coplien's
Advanced C++ book.  The ideas there may still be OK, but by now I
think most of the code is probably fairly outdated, and in this
particular case, the way that rep and count are used is a little
suspect.  We originally used the same method for the octave_value
class, but reorganized it some time back.  I've now checked in some
changes to make the mutex class look more like the current
octave_value class.

Thanks,

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]