gensio_acc...t_callback(3)

πŸ’– gensio_acc...t_callback β€” bestie edition πŸ’–

okay so this is a page from the Library Functions Manual (yes the gensio crew, they're iconic) and it's all about three little functions that handle your gensio accepter's event callback + user data situation. no cap, it's short but it's IMPORTANT, so let's go πŸ¦‹


✨ NAME ✨

gensio_accepter_set_callback, gensio_accepter_get_user_data, gensio_accepter_set_user_data β€” set the event callback and user data for a gensio accepter πŸŽ€


🌸 SYNOPSIS 🌸

#include <gensio/gensio.h>

void gensio_accepter_set_callback(struct gensio *io,
                    gensio_accepter_event cb, void *user_data)

void gensio_accepter_set_user_data(struct gensio *io, void *user_data);

void *gensio_accepter_get_user_data(struct gensio *io)

πŸ‘‘ DESCRIPTION πŸ‘‘

πŸ’… gensio_accepter_set_callback

sets the event handler and data for the gensio accepter. literally that's its whole job.

BUT β€” and this is the part where you gotta listen β€” you may call this function again only if the gensio accepter cannot generate any callbacks, which is generally after it has been shutdown. otherwise? race conditions may occur 😭 like, do not do that, bestie, it's giving chaos.

🫢 gensio_accepter_set_user_data

just sets the user_data field in the gensio accepter. that's it, that's the whole vibe.

⚠️ if this is called when the gensio is running, race conditions may occur. so like… be careful?? πŸ™ˆ

⭐ gensio_accepter_get_user_data

returns the user data that was passed in when the gensio accepter was created, or that was set by one of the above two functions. it just hands it back to you, no questions asked πŸ’–


🌈 SEE ALSO 🌈


and that's the whole page, bestie!! go forth and callback responsibly πŸ’œβœ¨

this lil beauty came from the Library Functions Manual, dated 27 Feb 2019 β€” so yeah, vintage queen behavior πŸ‘‘πŸ’… mwah, bye!! πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from