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 the gearman_task_st. it's your little backpack πŸŽ’ for passing information to a gearman_task_st.
  • gearman_task_context() returns the context that was used when the gearman_task_st was created (or the one 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. gearman_task_take_data() is the same as gearman_task_data() but the value it returns must be freed by the client with free(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(), and gearman_task_denominator() all return values related to the last status update made to the gearman_task_st. ⚠️ important: they do not cause the gearman_task_st to update itself. they just read the last news, they do not go get new news.
  • gearman_task_error() returns the last error message 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 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/>


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