GEARMAN_TASK_FREE(3)

πŸ’– NAME πŸ’–

gearman_task_free β€” it's giving Gearmand Documentation energy, fr fr, check it at <http://gearman.info/>


✨ 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.

Link with -lgearman


🌸 DESCRIPTION 🌸

okay so bestie, picture this: a gearman_task_st represents a task. That's it, that's the whole vibe. When a client sends work over to a gearman server, that work shows up as a task β€” and a worker receives that task in the form of a job. It's giving relay race, but make it distributed. πŸƒβ™€οΈβœ¨

Tasks β€” aka gearman_task_st β€” get created by calling one of these iconic little functions:

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

gearman_client_add_task_status() can also create a gearman_task_st, and those tasks are the ones you use to monitor a gearman_task_st you already made earlier. Like a lil stalker task. Lowkey obsessed. πŸ‘€

gearman_task_free() is what you use to free a task. And no, you don't have to do this every single time β€” you only need it if the task was created with a preallocated structure, or if you just want to clean up the memory of one specific task. Marie Kondo that task. 🧹

gearman_task_set_context() sets the given context of the gearman_task_st. The context is your little messenger bag β€” you can use it to pass 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 using free(3). Not optional, bestie. And 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() all return values related to the last status update made to the gearman_task_st. And here's the tea: they do NOT cause the gearman_task_st to update itself. It's giving "I already told you, don't ask me again." πŸ’…

gearman_task_error() returns the last error message that the gearman_task_st ran into. gearman_task_return() returns the last gearman_return_t that got stored. And if you see 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, baby's not ready. 😭


πŸŽ€ RETURN VALUE πŸŽ€

Various. And listen β€” any values returned by gearman_task_take_data() must have free(3) called on them. Don't forget, or that memory is just gonna live in your process forever rent-free. πŸ’€


πŸ¦‹ HOME πŸ¦‹

Wanna know more? Say less, go check: <http://gearman.info/>


🌈 SEE ALSO 🌈


πŸ‘‘ Author πŸ‘‘

Data Differential <http://www.datadifferential.com/>

2011-2014, Data Differential, <http://www.datadifferential.com/>


and that's a wrap, bestie! 🫢 This page came to you straight from version 1.1.21+ds, dated Feb 04, 2026, and it will forever be known as GEARMAN_TASK_FREE(3). Slay, stay hydrated, and always free your memory. βœ¨πŸŽ€πŸ’–

πŸ“¦ where this page comes from