Sorry. This is decades old technology.  A destroy method is utterly 
incompatible with reference counting.  Logically, it has to be this way.  
Anyone who is a passed a pointer is free to keep the pointer by increasing the 
reference count but is obligated to release it when finished.  It follows that 
unless you know exactly who is using a pointer (in which case you don't need 
reference counting), you can never know when it is safe to destroy the object.

This is basic software engineering 101.

Smart points automate addRef and release.  But you aren't talking about smart 
pointers, here, you talking bloody stupid pointers.

Jim Starkey


> On Feb 25, 2015, at 11:20 AM, Dmitry Yemanov <firebi...@yandex.ru> wrote:
> 
> 23.02.2015 13:36, Vlad Khorsun wrote:
> 
>>> A solution must be to pass a parameter to destroy methods specifying if
>>> they should release or not the object.
>> 
>> Must be ? I don't think so. I'm not ready to point to correct solution
>> right now, but additional parameter is not a solution, as for me.
>> I prefer to know more opinions...
> 
> I'd say that so called "destroy methods" should destroy the state but 
> not the object itself, which is the purpose of release(). The 
> "destroyed" state must be detectable by all object methods.
> 
> IObject* obj = ...
> ...
> obj->something(status); // success
> ...
> obj->destroy(status); // detach / commit / cancel / etc
> ...
> obj->something(status); // returns "bad handle" error
> ...
> obj->release(); // destroys the object (if use_count reaches zero)
> 
> And of course this should be followed by all implementations.
> 
> 
> Dmitry
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the 
> conversation now. http://goparallel.sourceforge.net/
> Firebird-Devel mailing list, web interface at 
> https://lists.sourceforge.net/lists/listinfo/firebird-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to