GEARMAN_TASK_GIVE_WORKLOAD(3)
π gearman_task_give_workload π
okay bestie, this page lives in the Gearmand manual, third section (that's the library-calls girlies), and it's genuinely a whole vibe if you're into libgearman. and you ARE, because you're here. let's GO. β¨
π SYNOPSIS
first thing's first, you gotta pull in the header:
#include <libgearman/gearman.h>
then here's the whole cast of characters, all written out exactly the way the page says them:
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, obviously, link it up:
-lgearman
π¦ DESCRIPTION
so. a gearman_task_st is the way this library represents a task. the work that a client sends over to a gearman server? that's what we call a task, no cap. and a worker receives that task in the form of a job. the whole little family tree, iconic. π
tasks (aka gearman_task_st) get born by calling one of these three:
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 ones are the surveillance tasks β they exist to monitor a gearman_task_st you made earlier. main character monitoring another main character, we love to see it. π
a quick tour of the functions, one by one:
gearman_task_free()β frees a task. you only actually gotta do this if the task was created with a preallocated structure, OR if you just wanna clean up the memory of one specific task. not every task needs it, so don't go freeing everything like a menace.gearman_task_set_context()β sets the given context on thegearman_task_st. the context is basically your little messenger bag: you use it to pass information to agearman_task_st.gearman_task_context()β hands you back the context that was used when thegearman_task_stwas created (or the one you set withgearman_task_set_context()).gearman_task_data()β gives you the current data that's been returned to the task. andgearman_task_data_size()gives you the size of that value.gearman_task_take_data()does the same thing asgearman_task_data(), BUT the value it returns must be freed by the client withfree(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(),gearman_task_denominator()β these return values related to the last status update that was made to thegearman_task_st. and this is important bestie: they do NOT cause thegearman_task_stto update itself. they just report. no refreshing, no poking the server, nothing. periodt.gearman_task_error()β returns the last error message that thegearman_task_stran into.gearman_task_return()returns the lastgearman_return_tthat got stored. and if you see a value ofGEARMAN_UNKNOWN_STATE, that means either the task hasn't been submitted to the server yet, OR no function was available if the job was submitted.
π RETURN VALUE
honestly? various. it depends. π€·
the one thing you cannot forget: any value returned by gearman_task_take_data() must have free(3) called on it. that's not optional, that's a promise you made. π«Ά
π HOME
wanna know more? go check out: http://gearman.info/
π SEE ALSO
βοΈ Author
Data Differential http://www.datadifferential.com/
Β©οΈ Copyright
2011-2014, Data Differential, http://www.datadifferential.com/
and that's the whole page, bestie!! π this beauty shipped as version 1.1.21+ds, dated Feb 04, 2026, and it answers to the name GEARMAN_TASK_GIVE_WORKLOAD(3). go forth and give some workload. slay. π
β¨
π¦ 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