GEARMAN_TASK_UNIQUE(3)
π gearman_task_unique β bestie's guide to the Gearmand libgearman task page π
okay so this is gearman_task_unique(3), straight outta the Gearmand docs (the official spot is <http://gearman.info/>). grab a snack, we're learning task internals and it's gonna be β¨ iconic β¨
πΈ NAME πΈ
gearman_task_unique β Gearmand Documentation, <http://gearman.info/>
β¨ SYNOPSIS β¨
bestie, it's giving C headers. here's the whole cast, exactly as written:
#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 <#c.uint32_t> gearman_task_numerator(const gearman_task_st *task)
uint32_t <#c.uint32_t> gearman_task_denominator(const gearman_task_st *task)
void gearman_task_give_workload(gearman_task_st *task, const void *workload, size_t <#c.size_t> workload_size)
size_t <#c.size_t> gearman_task_send_workload(gearman_task_st *task, const void *workload, size_t <#c.size_t> workload_size, gearman_return_t <#c.gearman_return_t> *ret_ptr)
const void *gearman_task_data(const gearman_task_st *task)
size_t <#c.size_t> gearman_task_data_size(const gearman_task_st *task)
void *gearman_task_take_data(gearman_task_st *task, size_t <#c.size_t> *data_size)
size_t <#c.size_t> gearman_task_recv_data(gearman_task_st *task, void *data, size_t <#c.size_t> data_size, gearman_return_t <#c.gearman_return_t> *ret_ptr)
const char *gearman_task_error(const gearman_task_st *task)
Added in version 0.21.
gearman_return_t <#c.gearman_return_t> gearman_task_return(const gearman_task_st *task)
Added in version 0.21.
Link with -lgearman
so yeah, when you build, you link with -lgearman. no cap. π₯
π¦ DESCRIPTION π¦
A gearman_task_st represents a task. periodt. π
the tea: work gets sent by a client to a gearman server, and the server sees that work as a task β meanwhile a worker receives that same task in the form of a job. two lanes, one vibe. π§
tasks (aka gearman_task_st) get created by calling one of these besties:
gearman_execute()gearman_client_add_task()gearman_client_add_task_background()
gearman_client_add_task_status() can also create a gearman_task_st β those ones are the little spies π΅οΈ used to monitor a gearman_task_st you already created earlier.
now, one by one, because we do not skip:
gearman_task_free()frees a task. you only need to do this if the task was created with a preallocated structure, or if you specifically wanna clean up the memory of one particular task. lowkey optional, highkey polite.gearman_task_set_context()sets the given context on thegearman_task_st. it's your little backpack π for passing information to agearman_task_st.gearman_task_context()returns the context that was used when thegearman_task_stwas created (or the one that was set withgearman_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 asgearman_task_data()but the value it returns must be freed by the client withfree(3).gearman_task_recv_data()is the one you bring your own pre-allocated buffers to. β¨gearman_task_is_known(),gearman_task_is_running(),gearman_task_numerator(), andgearman_task_denominator()all return values related to the last status update made to thegearman_task_st. β οΈ important: they do not cause thegearman_task_stto update itself. they just read the last news, they do not go get new news.gearman_task_error()returns the last error message thegearman_task_stran into.gearman_task_return()returns the lastgearman_return_tstored. and if you get a value ofGEARMAN_UNKNOWN_STATE, that means the task has not been submitted to the server yet β or, if the job has been submitted, that no function was available. π
π RETURN VALUE π
Various. literally "various", that's the whole answer. π
the one thing you cannot forget: any value returned by gearman_task_take_data() must have free(3) called on it. do not leave that memory hanging, bestie, it's not the vibe. π
π HOME π
to find out more information, go check out <http://gearman.info/> β it's the mothership. πΈ
π SEE ALSO π
π Author π
Data Differential <http://www.datadifferential.com/>
πΈ Copyright πΈ
2011-2014, Data Differential, <http://www.datadifferential.com/>
and that's the whole page, you ate it π«Ά this was version 1.1.21+ds, dated Feb 04, 2026 β mwah, go forth and free your memory, bestie πβ¨
π¦ 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