gnurl_multi_wakeup(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

  • curl_multi_wakeup β€” wakes up a sleeping curl_multi_poll call πŸ’… (yes bestie, this is the gnurl_multi_wakeup(3) page from the libgnurl manual, and it's lowkey iconic ✨)

πŸŽ€ SYNOPSIS πŸŽ€

#include <gnurl/curl.h>

CURLMcode curl_multi_wakeup(CURLM *multi_handle);

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this function can be called from any thread, and it wakes up a sleeping curl_multi_poll(3) call that is currently β€” or will be β€” waiting for activity or a timeout. Periodt πŸ’…

If you call it when there is no curl_multi_poll(3) call happening, it will cause the next call to return immediately. Not me making future plans for your poll 😭✨

Calling this function only guarantees to wake up the current curl_multi_poll(3) call β€” or the next one if there is no current call. Which means it is possible that multiple calls to this function will wake up the same waiting operation. So don't expect a one-wakeup-per-call receipt, bestie πŸ§ΎπŸ’€

And important: this function has no effect on curl_multi_wait(3) calls. Not even a little. πŸ™ˆ

🌈 RETURN VALUE 🌈

It returns a CURLMcode type β€” the general libcurl multi interface error code. That's the vibe check result 🫢

⭐ AVAILABILITY ⭐

Added in 7.68.0 β€” a classic, honestly πŸ‘‘

πŸ”₯ EXAMPLE πŸ”₯

Here's the whole example, no cap, exactly as the page lays it out:

CURL *easy_handle;
CURLM *multi_handle;

/* add the individual easy handle */
curl_multi_add_handle(multi_handle, easy_handle);

/* this is thread 1 */
do {
  CURLMcode mc;
  int numfds;

  mc = curl_multi_perform(multi_handle, &still_running);

  if(mc == CURLM_OK) {
    /* wait for activity, timeout or wakeup */
    mc = curl_multi_poll(multi_handle, NULL, 0, 10000, &numfds);
  }

  if(time_to_die())
    exit(1);

} while(still_running);

curl_multi_remove_handle(multi_handle, easy_handle);

/* this is thread 2 */

if(something makes us decide to stop thread 1) {

  set_something_to_signal_thread_1_to_exit();

  curl_multi_wakeup(multi_handle);
}

πŸ’œ SEE ALSO πŸ’œ

kisses bestie πŸ’‹ β€” this page is from libcurl 7.68.0, dated 17 Nov 2019, and it's the gnurl_multi_wakeup(3) manual page. Bye queen πŸ‘‘βœ¨

πŸ“¦ where this page comes from