Ticket #326 (new enhancement)

Opened 2 years ago

Last modified 2 years ago

AvahiThreadedPoll should use a recursive mutex

Reported by: obiltschnig Owned by: lennart
Milestone: Component: avahi-common
Keywords: Cc:

Description

The current locking requirements in AvahiThreadedPoll? make it difficult or even impossible to use AvahiThreadedPoll? for implementing a C++ (or other language, for that matter) API on top of it. The application must know whether it's calling into Avahi client from a callback or not, and must implement appropriate locking. This creates various nasty issues when trying to implement a higher-level API that automatically handles locking on top of this.

The issue could be quite easilly solved by making the mutex used by AvahiThreadedPoll? recursive, and by removing the assertions in avahi_threaded_poll_lock() and avahi_threaded_poll_unlock().

Change History

Changed 2 years ago by lennart

Hmm, Avahi is supposed to be portable, and unfortunately recursive mutex support is not standard among pthread implementations. If we would add this feature than we'd invite people to write unportable stuff.

I am not generally opposed to this, but it comes at a risk.

Changed 2 years ago by lennart

A patch for this can be a convincing argument.

Note: See TracTickets for help on using tickets.