GEARMAN_TASK_RETURN(3)
π GEARMAN_TASK_RETURN β the gearmand girlies' guide π
okay bestie, sit down, hydrate, because today we're talking about gearman_task_return and the whole task-girl squad from the Gearmand docs over at http://gearman.info/. this is the libgearman task API and honestly? it's giving infrastructure. no cap. π
β¨ SYNOPSIS β¨
#include <libgearman/gearman.h>
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 like, when you compile? link with -lgearman. don't forget it or the linker will simply not know you and that's so embarrassing for everyone involved π
πΈ DESCRIPTION πΈ
so. a gearman_task_st represents a task. and when a client sends work to a gearman server, that work is seen as a task. (meanwhile a worker receives that same thing in the form of a job. two names, one vibe. iconique.)
tasks β the whole gearman_task_st situation β get created by calling one of these:
gearman_execute()gearman_client_add_task()gearman_client_add_task_background()
also gearman_client_add_task_status() can create gearman_task_sts too, and those tasks are used to monitor a gearman_task_st you already made earlier. it's like keeping tabs on your ex but, y'know, productive π
gearman_task_free() frees a task. you only need to do this if a task was created with a preallocated structure, OR if you just want to clean up the memory of one specific task. tidying up >>> everything.
gearman_task_set_context() sets the given context of the gearman_task_st. the context is your little β¨payload of vibesβ¨ β you use it to pass information to a gearman_task_st.
gearman_task_context() returns the context that was used in the creation of the gearman_task_st (or that was set 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, bestie π. gearman_task_take_data() is the same as gearman_task_data() BUT β and this part matters β the value it returns must be freed by the client with free(3). gearman_task_recv_data() is the one you reach for when you've got pre-allocated buffers.
gearman_task_is_known(), gearman_task_is_running(), gearman_task_numerator(), and gearman_task_denominator() return values related to the last status update that was made to the gearman_task_st. and hear me on this: they do not cause the gearman_task_st to update itself. it is not going to refresh for you. it is not that kind of girl π
gearman_task_error() returns the last error message that the gearman_task_st ran into. gearman_task_return() returns the last gearman_return_t stored. and if you get a value of GEARMAN_UNKNOWN_STATE? that means the task hasn't been submitted to the server yet, or that no function was available if the job has been submitted. either way: unknown state, known mystery π₯
π« RETURN VALUE π«
Various. literally various. but listen β any value returned by gearman_task_take_data() must have free(3) called on it. please. your future self is begging π«Ά
π¦ HOME π¦
want more info? go check out: http://gearman.info/ β¨
β SEE ALSO β
π Author π
Data Differential http://www.datadifferential.com/
π Copyright π
2011-2014, Data Differential, http://www.datadifferential.com/
okay that's the whole page, girlies β this one came from the Gearmand docs, version 1.1.21+ds, dated Feb 04, 2026, and yes it's literally titled GEARMAN_TASK_RETURN(3). slay, read it, compile it, free your data. periodt π
π
π¦ 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