[avahi] browsing without event loop ?
Ludovic Courtès
ludovic.courtes at laas.fr
Mon Sep 3 10:39:29 PDT 2007
Hi,
Lennart Poettering <lennart at poettering.net> writes:
> On Mon, 03.09.07 16:57, Ludovic Courtès (ludovic.courtes at laas.fr) wrote:
>> My guess is that it's because it's cumbersome.
>>
>> Sometimes, you'd like to write something like:
>>
>> for machine in services(type=_workstation._tcp)
>> do
>> shutdown $machine
>> done
>>
>> Using the call-back API makes it hard to express such simple things.
>
> You're welcome to run the Avahi event loop only until a certain
> condition holds. i.e.:
>
> while (avahi_client_get_state(client) != AVAHI_CLIENT_FAILURE) {
> if (avahi_simple_poll_iterate(p, NULL) != 0)
> break;
> }
Sure, but it's harder to parse than the above.
> You are aware of AvahiThreadedPoll which does exactly this in C and
> has been part of Avahi since 0.6.3?
I did come across this page some time ago, but I had not interpreted it
as "what I want to do". ;-)
Thanks for the link, I'll look into it.
Ludo'.
More information about the avahi
mailing list