WSLAY_EVENT_WANT_READ(3)

πŸ’– WSLAY_EVENT_WANT_READ(3) πŸ’–

okay bestie, welcome to the wslay manual, section 3 πŸ¦‹ β€” this is the one about wslay_event_want_read and honestly? it's short and sweet and we're gonna slay it ✨


🌸 NAME 🌸

wslay_event_want_read β€” the lil function that tells you whether the library wants to read more data πŸ‘€


πŸŽ€ SYNOPSIS πŸŽ€

#include <wslay/wslay.h>

int wslay_event_want_read(wslay_event_context_ptr ctx)

yes that's the whole thing. one include, one call, one int. we love a minimal icon πŸ’…


✨ DESCRIPTION ✨

so like, wslay_event_want_read() exists purely to answer one question for you: does the library want to read more data from the peer or not? that's it, that's the whole job 🫢

and why do you care?? because this is the vibe-check you need when you're deciding whether to sit around waiting for a read event in your I/O event notification functions β€” think select(2) and poll(2), the classics 🌈. you don't wanna just block forever on a read that nobody asked for, so you ask this function first and it tells you what's up. main character energy fr fr πŸ‘‘


πŸ’€ RETURN VALUE πŸ’€

  • returns 1 if the library wants to read more data from the peer
  • returns 0 if it does not

that's the entire range. no weird negative numbers, no surprises. iconic behavior honestly 😭✨


πŸ‘‘ SEE ALSO πŸ‘‘

go give these besties a visit too, they're all in the same friend group:

  • wslay_event_want_write()
  • wslay_event_shutdown_read()
  • wslay_event_get_read_enabled()

iykyk 🧚


πŸ“ AUTHOR πŸ“

Tatsuhiro Tsujikawa β€” the actual legend behind all of this 🫑


2024, 2015, Tatsuhiro Tsujikawa


lowkey a whole bop of a manpage: one function, one question, one int. periodt πŸ’…πŸŒΈ

and that's a wrap on this page, bestie β€” this was wslay @PACKAGE_VERSION@, dated Apr 22, 2024, filing itself neatly under WSLAY_EVENT_WANT_READ(3). drink some water, go read your sockets responsibly, mwah πŸŽ€πŸ’–

πŸ“¦ where this page comes from