CURLMOPT_TIMERDATA(3)
π CURLMOPT_TIMERDATA(3) β from the Library Functions Manual, bestie β¨
Okay so real talk, this is a libcurl manual page and it's about CURLMOPT_TIMERDATA β the little custom pointer you hand off to your timer callback. Yes it's niche. Yes it's iconic. Let's get into it π
β¨ NAME β¨
CURLMOPT_TIMERDATA β custom pointer to pass to timer callback
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_TIMERDATA, void *pointer);
πΈ DESCRIPTION πΈ
So basically: this is a data pointer that gets passed to the timer callback you set with the CURLMOPT_TIMERFUNCTION(3) option. That's the whole vibe π«
And listen β libcurl does not touch this pointer, like at all, no cap. It literally just gets passed in to the timer callback's clientp argument. That's it. That's the job. Lowkey the easiest job in the whole library π
π DEFAULT π
NULL
(Yeah. Nothing. Empty. The void. She starts with nothing, bestie π)
π PROTOCOLS π
This functionality affects all supported protocols. Every single one. Slay, equal opportunity feature β¨
π EXAMPLE π
struct priv {
void *custom;
};
static int timerfunc(CURLM *multi, long timeout_ms, void *clientp)
{
struct priv *mydata = clientp;
printf("our ptr: %p\n", mydata->custom);
if(timeout_ms >= 0) {
/* this is the new single timeout to wait for */
}
else {
/* delete the timeout, nothing to wait for now */
}
return 0;
}
int main(void)
{
struct priv mydata;
CURLM *multi = curl_multi_init();
curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, timerfunc);
curl_multi_setopt(multi, CURLMOPT_TIMERDATA, &mydata);
}
Look at that. &mydata going in, showing up later as clientp. It's giving main character energy the way that pointer travels π«Ά
β AVAILABILITY β
Added in curl 7.16.0 β so she's been around a minute, an OG fr fr π
π₯ RETURN VALUE π₯
curl_multi_setopt(3) returns a CURLMcode indicating success or error.
CURLM_OK (that's 0) means everything was OK π β and anything non-zero means an error occurred, so go check libcurl-errors(3) for the tea π
π§ SEE ALSO π§
Okay bestie, remember: the pointer is yours, libcurl is just the messenger. Don't make it weird π
libcurl Β· 2026-10-12 Β· that's the whole page, mwah πβ¨ bye babes! π¦π
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms