gensio_acc_shutdown(3)

✨ NAME ✨

gensio_acc_shutdown, gensio_acc_shutdown_s, gensio_acc_disable, gensio_acc_free β€” bestie, this is how you stop and free a gensio accepter that's already started up πŸ›‘

From the Library Functions Manual, no less. Very official. Very demure. πŸ’…


🌸 SYNOPSIS 🌸

#include <gensio/gensio.h>

typedef void (*gensio_acc_done)(struct gensio_accepter *acc,
                                   void *cb_data);

int gensio_acc_shutdown(struct gensio_accepter *accepter,
                                   gensio_acc_done shutdown_done,
                                   void *shutdown_data);

int gensio_acc_shutdown_s(struct gensio_accepter *accepter);

void gensio_acc_disable(struct gensio_accepter *accepter);

void gensio_acc_free(struct gensio_accepter *accepter);

okay so that's the whole cast of characters right there πŸŽ€ four functions, one callback type, and they all live in <gensio/gensio.h>.


πŸ’– DESCRIPTION πŸ’–

So you've got an accepter, it's out there doing its thing, and now you need it to stop. That's literally what this page is about. Let's go one by one, bestie πŸ¦‹

gensio_acc_shutdown 🌈

This one closes all sockets and disables everything in the gensio accepter. All of it. Gone. Closed for business, doors locked, lights off ✨

If it succeeds, shutdown_done() gets called after the shutdown is complete β€” but only if shutdown_done is not NULL. So if you pass a null callback, no callback happens, obviously, and that's on you 🫢

Returns GE_INUSE if the accepter is already shut down. Returns zero otherwise.

bestie the GE_INUSE thing is important β€” if you try to shut down something that's already shut down, you get GE_INUSE, not a happy zero. know the difference πŸ’€

gensio_acc_shutdown_s ⭐

This is the synchronous one. It shuts down the gensio and waits for the shutdown to finish. Very "I will stand here until this is done" energy πŸ‘‘

⚠️ but like, seriously β€” see the notes in gensio_close_s(3) for the warning on using this. There are warnings. Go read them. Don't just vibe your way into a blocking call, bestie 😭

gensio_acc_disable 🧚

It's like gensio_disable(3), but for accepters. That's it. That's the whole description. Go read gensio_disable(3) for the details, because the details live over there πŸ’œ

gensio_acc_free πŸŽ€

This frees the network accepter. Periodt. πŸ—‘οΈ

But listen β€” if the network accepter is started up, this shuts it down first, and shutdown_done() is NOT called. Not called. Not even a little. So don't be sitting around waiting for that callback, because it is not coming πŸ™ˆ


πŸ”₯ RETURN VALUES πŸ”₯

  • Zero β€” success, slay, we love to see it πŸ’–
  • A gensio error β€” failure, and it's giving "something went wrong" 😭

That's it. That's the whole return contract. Note that this applies to the functions that return int β€” gensio_acc_disable and gensio_acc_free return void, so there's nothing to check there, they just do the thing πŸ‘‘


🌈 SEE ALSO 🌈

go read those too, they're the supporting cast and they matter πŸ’…


okay bestie that's the whole page!! gensio_acc_shutdown(3), from the Library Functions Manual, dated 27 Feb 2019 β€” that's the source and version and date, and that's your cute little sign-off, mwah πŸ’‹πŸ¦‹βœ¨

πŸ“¦ where this page comes from