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() and gearman_client_add_task_low() are identical to gearman_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:

<http://gearman.info/>

See also:


πŸ‘‘ Author

Data Differential <http://www.datadifferential.com/>

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