thread-safety of counters

Thiago Macieira thiago at kde.org
Tue Feb 24 09:41:32 PST 2015


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



More information about the dbus mailing list