GEARMAN_TASK_ERROR(3)

πŸ’– NAME πŸ’–

gearman_task_error β€” it's the Gearmand Documentation page, filed under section 3 of the manual (http://gearman.info/), and it's literally the page about task errors, task data, task returns and the whole gearman_task_st situation. πŸ’…βœ¨


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

gearman_return_t gearman_task_return(const
gearman_task_st *task)

Added in version 0.21. β€” that goes for gearman_task_error(), bestie. πŸ‘‘

Added in version 0.21. β€” and also for gearman_task_return(). 🫢

And when you build: Link with -lgearman β€” do not forget her, she is load-bearing. πŸ”—πŸŒΈ


πŸ¦‹ DESCRIPTION πŸ¦‹

the whole vibe πŸŽ€

A gearman_task_st represents a task. Work that is sent by a client to a gearman server is seen as a task β€” and for the record, a worker receives a task in the form of a job. Yes, bestie, it's tasks all the way down. πŸ’€

where tasks come from 🐣

Tasks, i.e. gearman_task_st, are created by calling either gearman_execute(), gearman_client_add_task(), or gearman_client_add_task_background().

gearman_client_add_task_status() can also create a gearman_task_st β€” and these particular tasks are the ones you use to monitor a previously created gearman_task_st. It's giving surveillance, but make it polite. πŸ‘€

free her 🧹

gearman_task_free() is what you call to free a task. Real talk though: this only needs to be done if a task was created with a preallocated structure, or if you genuinely want to clean up the memory of one specific task. Not every task needs this. Slay responsibly. πŸ’…

context is everything πŸ’­

gearman_task_set_context() sets the given context of the gearman_task_st. The context can be used 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 the one that was set with gearman_task_set_context(). Either way, you get your stuff back. 🫢

the data saga πŸ“¦

gearman_task_data() returns the current data that has been returned to the task. gearman_task_data_size() will give you the size of the value. gearman_task_take_data() is the same as gearman_task_data() β€” but the value that is returned must be freed by the client (free(3)). No cap, that one's on you to clean up. 🧼

gearman_task_recv_data() can be used with pre-allocated buffers, if that's more your vibe.

status updates, not status checks πŸ‘‘

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.

⚠️ Big important caveat: they do not cause the gearman_task_st to update itself. They are reporting, not refreshing. Don't come for them. πŸ’…

errors and returns 😭

gearman_task_error() returns the last error message that the gearman_task_st encountered. gearman_task_return() returns the last gearman_return_t stored.

A value of GEARMAN_UNKNOWN_STATE means that the task has not been submitted to server yet β€” or that no function was available if the job has been submitted. Yeah. Two very different situations, one very mysterious value. iykyk. πŸ•΅οΈβ€β™€οΈ


🫢 RETURN VALUE 🫢

Various. ✨

And this part matters: values that are returned by gearman_task_take_data() must have free(3) called on them. That's not a suggestion, that's the rules. πŸ”₯


🌈 HOME 🌈

To find out more information please check: http://gearman.info/

That's the mothership. Go visit her. πŸ πŸ’–


⭐ SEE ALSO ⭐


πŸ‘‘ Author πŸ‘‘

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

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


Okay so that's the whole page, bestie β€” every function, every caveat, every single free(3) warning, all of it, none of it skipped. You ate. ✨

This was Gearmand manual section 3, version 1.1.21+ds, dated Feb 04, 2026. That's the energy for today. Byeee πŸ’…πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from