GEARMAN_CLIENT...ASK_BACKGROUND(3)

πŸ’– GEARMAN_CLIENT...ASK_BACKGROUND(3) πŸ’–

okay bestie, gather round, because this one is a Gearmand joint (that's manual section 3, the library-call zone, iykyk ✨) and it's literally just Gearmand Documentation, http://gearman.info/ energy from top to bottom.


🌸 NAME 🌸

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


πŸŽ€ SYNOPSIS πŸŽ€

First things first, you gotta pull in the header:

#include <libgearman/gearman.h>

Then, three lil' besties with the exact same shape, differing only in the priority they're serving:

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 link it, you link it like this:

-lgearman

periodt. πŸ’…


✨ DESCRIPTION ✨

So gearman_client_add_task_background() does exactly what it says on the tin, no cap: it creates a background task and adds it to the gearman_client_st you handed it. But here's the tea β€” execution of the task does not begin until you call gearman_client_run_tasks(). So it's just vibing in the queue until you say go. πŸ¦‹

If the unique value isn't set, then a unique will be assigned. Don't stress about it, it gets handled 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 shift. πŸ”₯

⚠️ Warning, bestie, read this one fr fr: 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(). Not optional. Free your task, love yourself. 🫢

πŸ‘‘ RETURN VALUE πŸ‘‘

The gearman_task_st is created and a pointer to it is returned β€” it's giving main character. But on error NULL is returned and ret_ptr is set with a gearman_return_t. So yeah, check that ret_ptr, okay? 😭


🌈 HOME 🌈

To find out more information please check: 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, babe πŸ’– this was version 1.1.21+ds, dated Feb 04, 202 (yes the footer date literally got chopped, iconic behavior, we love a cliffhanger πŸ’€). catch you in the next man page, slay! πŸŒΈπŸ¦‹βœ¨

πŸ“¦ where this page comes from