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/>
πΈ Copyright πΈ
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
- 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