Re: thread-safety of counters

Thiago Macieira <[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <2037441.NsuxnzKUU5@tjmaciei-mobl4>
On Tuesday 24 February 2015 09:50:59 Adrian Szyndela wrote:
> W dniu 23.02.2015 o 21:06, Thiago Macieira pisze:
> > dbus_message_cache_or_finalize implies that the reference count has
> > dropped to  zero, which means there's no concurrency issue any more.
> 
> That's right, reference count for the _message_ is zero. But reference
> count for a counter (the one from message->counters) is non-zero. In
> fact, it should be at least 1 for the whole lifetime of
> connection->transport. The problem is, that it drops to zero due to
> non-atomic reference count, and is freed, while connection->transport is
> still alive.

Sorry, I dispute that.

DBusCounter is not meant to be atomic. All accesses should be protected by 
mutex.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

_______________________________________________
dbus mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.