GEARMAN_TASK_TAKE_DATA(3)

🌸 GEARMAN_TASK_TAKE_DATA πŸ’…

okay bestie, so this is a page from the Gearmand manual (section 3, the library-calls section, iykyk) and it's literally all about taking data off a task. no cap, this one ate. let's get into it 🫢


✨ NAME ✨

gearman_task_take_data β€” Gearmand Documentation, <http://gearman.info/>

like, that's the whole vibe. the docs live at <http://gearman.info/> and this page is your backstage pass to the task-data situation πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

first things first, you gotta pull in the header:

#include <libgearman/gearman.h>

and then here's the whole squad of functions that show up on this page, fr fr:

type gearman_task_st

void gearman_task_free(gearman_task_st *task)

void *gearman_task_context(const gearman_task_st *task)

void gearman_task_set_context(gearman_task_st *task, void *context)

const char *gearman_task_function_name(const gearman_task_st *task)

const char *gearman_task_unique(const gearman_task_st *task)

const char *gearman_task_job_handle(const gearman_task_st *task)

bool gearman_task_is_known(const gearman_task_st *task)

bool gearman_task_is_running(const gearman_task_st *task)

uint32_t gearman_task_numerator(const gearman_task_st *task)

uint32_t gearman_task_denominator(const gearman_task_st *task)

void gearman_task_give_workload(gearman_task_st *task, const void *workload, size_t workload_size)

size_t gearman_task_send_workload(gearman_task_st *task, const void *workload, size_t workload_size, gearman_return_t *ret_ptr)

const void *gearman_task_data(const gearman_task_st *task)

size_t gearman_task_data_size(const gearman_task_st *task)

void *gearman_task_take_data(gearman_task_st *task, size_t *data_size)

size_t gearman_task_recv_data(gearman_task_st *task, void *data, size_t data_size, gearman_return_t *ret_ptr)

const char *gearman_task_error(const gearman_task_st *task)

✨ Added in version 0.21. ✨

gearman_return_t gearman_task_return(const gearman_task_st *task)

✨ Added in version 0.21. ✨

and uh, link with -lgearman or it's giving undefined reference energy 😭 don't do that to yourself.

πŸ¦‹ DESCRIPTION πŸ¦‹

So. A gearman_task_st represents a task. Groundbreaking, I know πŸ’… but here's the actual tea: work that gets sent by a client over to a gearman server is seen as a task β€” and a worker receives that task in the form of a job. same energy, different name, keep up bestie 🧚

Tasks (aka your gearman_task_st besties) get created by calling one of these three:

  • gearman_execute()
  • gearman_client_add_task()
  • gearman_client_add_task_background()

gearman_client_add_task_status() can also create a gearman_task_st β€” but these ones are the nosy-friend type, they exist to monitor a previously created gearman_task_st. surveillance era πŸ‘‘

gearman_task_free() is how you free a task. ngl you only actually need to do this if the task was created with a preallocated structure, or if you just want to clean up the memory of one specific task. main character memory management, periodt.

gearman_task_set_context() sets the given context of the gearman_task_st. The context is basically a little backpack you can pass information around in πŸŽ’

gearman_task_context() returns the context that was used when the gearman_task_st was created (or the one you set later with gearman_task_set_context()).

gearman_task_data() returns the current data that has been returned to the task. gearman_task_data_size() gives you the size of that value. gearman_task_take_data() is the same as gearman_task_data() except β€” and this is the important part β€” the value that is returned must be freed by the client with free(3). gearman_task_recv_data() is the one you use when you've already got a pre-allocated buffer waiting 🌸

gearman_task_is_known(), gearman_task_is_running(), gearman_task_numerator(), and gearman_task_denominator() all return values related to the last status update that was made to the gearman_task_st. They do not cause the gearman_task_st to update itself. it's giving "reading the receipts, not sending new ones" πŸ’€

gearman_task_error() returns the last error message that the gearman_task_st encountered. gearman_task_return() returns the last gearman_return_t that got stored. And listen β€” a value of GEARMAN_UNKNOWN_STATE means either that the task hasn't been submitted to the server yet, or that no function was available if the job has been submitted. both are valid, it's not a crisis (okay it might be a little bit of a crisis πŸ™ˆ).


⭐ RETURN VALUE ⭐

Various. like, various various. and the values that come back from gearman_task_take_data() must have free(3) called on them. take the data, free the data. balanced as all things should be 🫢


🌈 HOME 🌈

want more? 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, bestie!! πŸ’– tysm for reading, you're literally the icon of understanding task data. this was 1.1.21+ds, dated Feb 04, 2026, straight from the Gearmand manual β€” now go free that memory and slay βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from