GEARMAN_CLIENT_ADD_TASK(3)
π GEARMAN_CLIENT_ADD_TASK π
okay bestie so this is a page from the gearmand manual, section 3 (that's the library-call section, not the command section, iykyk). buckle up, we're adding tasks to a gearman client and we're doing it adorably.
β¨ NAME β¨
gearman_client_add_task β Gearmand Documentation, <http://gearman.info/>
like. that's literally the whole name section. it's giving minimalist. π
πΈ SYNOPSIS πΈ
first you gotta #include the good stuff:
#include <libgearman/gearman.h>
then the three sisters show up. yes there's three. one normal, one high-priority, one low-priority. queen behavior:
gearman_task_st <#c.gearman_task_st>
*gearman_client_add_task(gearman_client_st <#c.gearman_client_st>
*client, gearman_task_st <#c.gearman_task_st> *task, void *context,
const char *function_name, const char *unique, const void *workload,
size_t <#c.size_t> workload_size, gearman_return_t <#c.gearman_return_t>
*ret_ptr)
gearman_task_st <#c.gearman_task_st>
*gearman_client_add_task_high(gearman_client_st <#c.gearman_client_st>
*client, gearman_task_st <#c.gearman_task_st> *task, void *context,
const char *function_name, const char *unique, const void *workload,
size_t <#c.size_t> workload_size, gearman_return_t <#c.gearman_return_t>
*ret_ptr)
gearman_task_st <#c.gearman_task_st>
*gearman_client_add_task_low(gearman_client_st <#c.gearman_client_st>
*client, gearman_task_st <#c.gearman_task_st> *task, void *context,
const char *function_name, const char *unique, const void *workload,
size_t <#c.size_t> workload_size, gearman_return_t <#c.gearman_return_t>
*ret_ptr)
and when you link, you link with -lgearman or it simply will not go, bestie. π«Ά
π¦ DESCRIPTION π¦
okay so gearman_client_add_task() does exactly what the name says (rare, iconic): it creates a task and adds it to the given gearman_client_st. that's it. that's the whole job.
but. and this is the important part, do not skip this β
the task does not start running the second you add it. no no. execution of the task does not begin until you call gearman_client_run_tasks(). it just sits there, waiting, main character energy, until you give it the go-ahead. π
also, if the unique value is not set, then a unique will be assigned for you. no need to panic, the system's got you.
now for the twins:
gearman_client_add_task_high()andgearman_client_add_task_low()are identical togearman_client_do()β except (the plot twist β¨) they set the priority to either high or low.
so like. same task-adding behavior, different priority vibe. high goes brrr first, low waits its turn. slay.
β RETURN VALUE β
on success: the gearman_task_st gets created and a pointer to it is returned to you. take it, it's yours now. π
on error: NULL is returned β and ret_ptr gets set with a gearman_return_t so you can find out what went wrong. not me getting a NULL and a whole explanation π
π HOME π
wanna know more? (of course you do.) go check out:
See also:
π Author
Data Differential <http://www.datadifferential.com/>
π Copyright
2011-2014, Data Differential, <http://www.datadifferential.com/>
and that's the whole page, bestie, no cap. this was Gearmand's GEARMAN_CLIENT_ADD_TASK(3), version 1.1.21+ds, dated Feb 04, 2026 β so fresh, so clean, so iconic πβ¨ go add some tasks, you absolute legend π§π
π¦ where this page comes from
- ubuntu resolute: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- ubuntu stonking: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms