GEARMAN_CLIENT...LOW_BACKGROUND(3)

πŸ’… GEARMAN_CLIENT...LOW_BACKGROUND πŸ’…

okay bestie, welcome to the Gearmand manual, section 3 (library calls, the girlies who link things). This page is literally three whole functions that live in the same vibe, so let's get into it ✨


🌸 NAME 🌸

gearman_client_add_task_low_background β€” Gearmand Documentation, http://gearman.info/

she's the low-priority background task adder, and she brought her sisters πŸ’–


✨ SYNOPSIS ✨

first things first, you gotta include the header:

#include <libgearman/gearman.h>

and here are the three icons themselves, all matching, all gorgeous:

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 when you build, you link with -lgearman. no cap 🫢


πŸ‘‘ DESCRIPTION πŸ‘‘

so gearman_client_add_task_background() creates a background task and adds it into the given gearman_client_st. key detail alert: the task does not start executing until you call gearman_client_run_tasks(). it just sits there, patiently, main character waiting for her cue πŸŽ€

if the unique value isn't set, then a unique will be assigned for you. the library is being nice, let her cook.

gearman_client_add_task_high_background() and gearman_client_add_task_low_background() are identical to gearman_client_do(), only they set the priority to either high or low. that's it, that's the whole difference. priorities, bestie, it's giving VIP section vs. general admission πŸ’…

πŸ’€ Warning πŸ’€

You may wish to avoid using gearman_client_add_task_background() with a stack based allocated gearman_task_st. The most common issues related to ABI safety involve stack allocated structures. If you use a stack based gearman_task_st you must free it with gearman_task_free().

fr fr, this one MATTERS. stack-allocated gearman_task_st plus this function is a whole ABI safety hazard, and if you go down that road you are legally (well, morally) obligated to gearman_task_free() it. do not skip that step, I am begging πŸ™ˆ


🌈 RETURN VALUE 🌈

the gearman_task_st gets created, and a pointer to it comes back to you. slay, mission accomplished ✨

but if there's an error, NULL is returned and ret_ptr gets set with a gearman_return_t. so like, always check, okay? check the pointer, check ret_ptr, be a responsible icon πŸ¦‹


πŸ’œ HOME πŸ’œ

want more lore? go look at http://gearman.info/

See also: gearmand(8) libgearman(3) gearman_task_st


πŸ“ Author πŸ“

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

2011-2014, Data Differential, http://www.datadifferential.com/


anyway that's the page!! this one is version 1.1.21+ds and it's dated Feb 04, and the year got a lil squished by GEARMAN_CLIENT...LOW_BACKGROUND(3) down at the bottom of the original β€” she's got range, she's got ABI warnings, she's got it all. go free your tasks, love you, bye πŸ’–πŸ§šβ­

πŸ“¦ where this page comes from