SD_BUS_PE...THOD_CALLS(3)

✨ SD_BUS_PE...THOD_CALLS(3) ✨

okay so bestie, this one's from the sd_bus_pending_method_calls corner of the manual, and it's genuinely so useful β€” it's the "how many texts have I sent that they haven't replied to yet" of D-Bus πŸ’…


🌸 NAME 🌸

sd_bus_pending_method_calls β€” returns the number of currently pending, outgoing method calls πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <systemd/sd-bus.h>

int sd_bus_pending_method_calls(sd_bus *bus);

πŸ’– DESCRIPTION πŸ’–

so sd_bus_pending_method_calls() literally just hands you back the count of currently pending outgoing method calls. and what does that mean? it means method calls that were enqueued with sd_bus_call_async(3) where no reply has come back yet, and which haven't hit a timeout yet either. like, still in flight, still waiting on read receipts, no cap 🫢

and here's the cute part: the bus argument can totally be NULL, and in that case you just get zero back. no drama, no crash, just a lil zero ✨

⭐ RETURN VALUE ⭐

this function returns 0 if there are no pending method calls, or if a NULL bus object was specified. and if something goes wrong? you get a negative errno-style error code back. 😭

πŸ™ˆ Errors

the errors it can throw at you may indicate these problems:

  • -ECHILD β€” the bus connection was created in a different process, library or module instance. like, wrong group chat entirely, bestie πŸ’€

πŸ‘‘ NOTES πŸ‘‘

the functions described here are available as a shared library, which you can compile against and link to with the libsystemd pkg-config(1) file. slay πŸŽ€

all functions listed here are thread-agnostic, and only a single thread may operate on a given object at any given time. different threads can access the same object at different times, and multiple independent objects can be used from different threads in parallel. so like β€” share the object, just not at the same second, iykyk 🌈

heads up bestie: the code described here uses getenv(3), which is declared to be not multi-thread-safe. that means the code calling the functions described here must not call setenv(3) from a parallel thread. the recommendation is to only do calls to setenv() from an early phase of the program, when no other threads have been started yet. don't be messy about it πŸ’…

🧚 HISTORY 🧚

sd_bus_pending_method_calls() was added in version 257. iconic behavior, honestly πŸ‘‘

🌟 SEE ALSO 🌟

systemd(1), sd-bus(3), sd_bus_call_async(3)


and that's the whole page, bestie β€” brought to you by systemd 261.3, the version this gorgeous lil manual page ships with. go count those pending calls, you're gonna ate πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from