From: Alex P. <pes...@ma...> - 2011-03-30 10:24:06
|
On 03/29/11 18:58, Adriano dos Santos Fernandes wrote: > On 29-03-2011 10:45, Alex Peshkoff wrote: >> We have too many problems in single thread. I try to divide it to >> smaller parts. >> The first one - here we at least all seem to talk about same thing:-) - >> is to use reference counters or not. >> >> On 03/28/11 22:45, Adriano dos Santos Fernandes wrote: >>> User should *not* request a detachment and then request actions on the >>> objects. This *is* user application problem, no mater it being single or >>> multi thread. >> In that case our new API is regression compared with old ISC API with >> handles. Pre FB3 an attempt to request actions on the objects after >> detachment cause correct reply from client library - invalid handle. >> Without reference count support we will get segfault in FB3. I treat >> this as serious regression. >> > You're trying to make two different worlds to look similar. > > Take another look at it. > > Thread 1 detachs and makes it handle invalid. > > Thread 2 allocs 0xFFFFFFFF handles. > > Thread 3 is scheduled to run and use the old invalid, but now valid handle. > > Very pessimistic and "impossible" to happen, but shows that application > doing this with handles are still incorrect. As you understand yourself, this is not realistic example. Cases when thread 3 is trying to work with old invalid handle and gets appropriate error message is reality. > You also didn't replied yet to me what will happen when you detach a > parent without free children: leaks or will regret your refcounters? Sorry, may be I've missed that question. The answer is simple - objects will exist until refcounters > 0, but will be marked in a way, making them return 'object is invalid' error for any request. > In anyway, it shows you're using an incorrect solution. > This words are absolutely unrelated with what you've asked before... >> As one of users replied: Object-based interfaces should use the refcount. > Against him is almost entire world who built API without refcount. All the world is ambiguous here. See for example http://api.openoffice.org/docs/common/ref/com/sun/star/uno/XInterface.html BTW, all people who care about thread safety build object-oriented API with reference counters. |