linux - What is a 'slot' in sd-bus (C language) -


there several apis in systemd's sd-bus.h file optionally take slot argument. here's examples:

int sd_bus_call_async(sd_bus *bus, sd_bus_slot **slot, sd_bus_message *m, sd_bus_message_handler_t callback, void *userdata, uint64_t usec); int sd_bus_add_filter(sd_bus *bus, sd_bus_slot **slot, sd_bus_message_handler_t callback, void *userdata); int sd_bus_add_fallback(sd_bus *bus, sd_bus_slot **slot, const char *prefix, sd_bus_message_handler_t callback, void *userdata); 

if calling code specifies null becomes "floating slot" guess means calling code doesn't need worry it.

most of example source code see out there example project: https://github.com/tasleson/dbus-signals/blob/6d0e43d02d24ed51a17ce7df15a3a0a64ec0170d/spamsignals.c#l160

it takes slot, , sometime later unreferences slot. doesn't it.

passing own slot makes sd-bus-match life being entangled 1 of slot. way, when unreference slot, destroying match.
otherwise, passing null bound match's life 1 of bus object itself.
same goes other functions listed:
* sd_bus_call_async slot gives option destroy async call unreferencing slot.
*sd_bus_add_filter slot destroy filter when unreference slot.
not sure sd_bus_add_fallback because never heard though.
check here function being called when slot gets unreferenced: https://github.com/systemd/systemd/blob/a7753693547233e4a1d6e10b1a8f6515a477f227/src/libsystemd/sd-bus/bus-slot.c#l68


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -