[avahi] DBus issues

Lennart Poettering lennart at poettering.net
Thu Sep 4 11:02:03 PDT 2008


On Thu, 04.09.08 19:46, Stefan de Konink (avahi at ml.kinkrsoftware.nl) wrote:

> 
> Lennart Poettering schreef:
> > Ah, so your are using the threaded event loop. This smells a lot like
> > that you have some locking issues here: maybe you forgot to enclose
> > code accessing the avahi client object in _lock() and _unlock()?
> 
> Should this *always* happen when something access the client? So for
> every resolver that is created...?

Whenever you access one of the objects that are attached to the event
loop thread (i.e. the one that is maintained by AvvahiThreadedPoll)
you need to make sure that the event loop thread (or any other thread)
does not intefere with your call. That means you need to take the lock
of thre event loop thread via avahi_threaded_poll_lock() whenever you
call any of the avahi_client_xxx(), avahi_xxx_browser_xxx(),
avahi_xxx_resolver_xxx() and avahi_entry_group_xxx() calls. 

The callback functions are dispatched from the event loop thread, and
are thus called with the lock taken already -- from the callbacks you
should thus not take the lock yourself anymore.

> If you say... please lock around any client access (even inside
> callbacks :S)... I'll try to do this. If you have other suggestions,
> please make them.

Enclose every of the aforementioned calls in
avahi_threaded_poll_lock() and avahi_threaded_poll_unlock() -- except
the callbacks that are dispatched from the event loop thread.

Have you read this?

http://avahi.org/wiki/RunningAvahiClientAsThread

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the avahi mailing list