GEARMAN_CLIENT_ADD_TASK_HIGH_BACKGROUND(3)
π NAME π
gearman_client_add_task_high_background β the Gearmand docs situation, live at <http://gearman.info/> β¨
πΈ SYNOPSIS πΈ
okay bestie, first you gotta pull in the header:
#include <libgearman/gearman.h>
then here's the whole trio of glow-ups you get:
gearman_task_st
*gearman_client_add_task_background(gearman_client_st *client,
gearman_task_st *task,
void *context,
const char *function_name,
const char *unique,
const void *workload,
size_t workload_size,
gearman_return_t *ret_ptr)
gearman_task_st
*gearman_client_add_task_high_background(gearman_client_st *client,
gearman_task_st *task,
void *context,
const char *function_name,
const char *unique,
const void *workload,
size_t workload_size,
gearman_return_t *ret_ptr)
gearman_task_st
*gearman_client_add_task_low_background(gearman_client_st *client,
gearman_task_st *task,
void *context,
const char *function_name,
const char *unique,
const void *workload,
size_t workload_size,
gearman_return_t *ret_ptr)
and don't forget to link it, literally the whole thing falls apart otherwise:
-lgearman
β¨ DESCRIPTION β¨
so gearman_client_add_task_background() does the thing: it creates a background task and drops it into the gearman_client_st you handed it π«Ά. and here's the tea β the task does NOT start running the second you add it. nope. it sits there patiently like a good little task until you call gearman_client_run_tasks(). that's the moment it wakes up. periodt.
if the unique value isn't set? no stress, a unique gets assigned for you π .
now gearman_client_add_task_high_background() and gearman_client_add_task_low_background() are identical to gearman_client_do(), the only difference being that they set the priority to either high or low. that's it, that's the whole personality change π.
β οΈ Warning, and I need you to actually read this one bestie: you may want to avoid usinggearman_client_add_task_background()with a stack-allocatedgearman_task_st. like, genuinely. the most common issues related to ABI safety involve stack-allocated structures π. and if you do go ahead and use a stack-basedgearman_task_st, you must free it withgearman_task_free(). no skipping that part. fr fr.
π« RETURN VALUE π«
the gearman_task_st gets created and a pointer to it comes back to you π.
but if things go sideways? on error, NULL is returned and ret_ptr gets set with a gearman_return_t so you know exactly what went wrong. the receipts are there, iykyk π.
π¦ HOME π¦
to find out more info, go peek at: <http://gearman.info/>
See also (the whole squad):
gearmand(8)libgearman(3)gearman_task_st
π Author π
Data Differential β <http://www.datadifferential.com/>
π Copyright π
2011-2014, Data Differential, <http://www.datadifferential.com/>
and that's the whole page, diva π this was 1.1.21+ds, dated Feb 04, 20β¦, brought to you by the Gearmand girlies. slay, go write your background tasks responsibly π§β¨
π¦ 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