GEARMAN_TASK_NUMERATOR(3)

🌸 NAME 🌸

gearman_task_numerator β€” Gearmand Documentation, http://gearman.info/

okay bestie, we are deep in the gearmand docs rn 🫢 and yeah the page name is gearman_task_numerator, but it's lowkey the whole task-object page β€” the numerator function is just the main character it got named after πŸ’… stay with me, it all makes sense by the end, i promise.


✨ SYNOPSIS ✨

here's the entire cast, no cap πŸ‘‘ everything lives in libgearman/gearman.h, and you link with -lgearman:

#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
heads up: gearman_task_return() and its little "Added in version 0.21." note show up near the bottom of that list β€” yes, 0.21, that's the era bestie ⭐

πŸ’– DESCRIPTION πŸ’–

A gearman_task_st represents a task. When a client sends work over to a gearman server, that work is seen as a task β€” and on the other side a worker receives that task in the form of a job. that's the whole friend group dynamic, iconic honestly 🌈

So where do these task things even come from? You create a gearman_task_st by calling any one of these:

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

And plot twist πŸ“ β€” gearman_client_add_task_status() can create a gearman_task_st too, but those ones are for monitoring a gearman_task_st you already made earlier. it's giving "second task, same vibe, different job".


πŸŽ€ the free & context situation

gearman_task_free() is how you free a task. You only need to do this if the task was created with a preallocated structure, or if you just really wanna clean up the memory of one specific task. lowkey optional, highkey valid ✨

gearman_task_set_context() sets the given context on the gearman_task_st. Handy lil thing β€” the context is how you pass information into a gearman_task_st. And gearman_task_context() gives you back the context that was used when the gearman_task_st was created (or whatever got set with gearman_task_set_context(). 🫢

πŸ¦‹ the data girls

  • gearman_task_data() β€” returns the current data that's been returned to the task.
  • gearman_task_data_size() β€” the size of that value, right there.
  • gearman_task_take_data() β€” same energy as gearman_task_data(), BUT the value it hands you must be freed by the client with free(3). not negotiable bestie, that's your memory now πŸ”₯
  • gearman_task_recv_data() β€” this one's for when you already have pre-allocated buffers. so prepared of you, love that πŸ’œ

πŸ‘‘ the status-update squad

gearman_task_is_known(), gearman_task_is_running(), gearman_task_numerator(), and gearman_task_denominator() all return values related to the last status update that was made to the gearman_task_st.

🚨 important: they do not cause the gearman_task_st to update itself. they just tell you what they already know. no refreshing, no chasing, they are not doing the work for you πŸ’€

😭 the errors & the return value

gearman_task_error() returns the last error message that the gearman_task_st ran into. and gearman_task_return() returns the last gearman_return_t that got stored.

A value of GEARMAN_UNKNOWN_STATE means one of two things: the task hasn't been submitted to the server yet, or no function was available if the job has been submitted. either way β€” unknown state, we said what we said 🌸


⭐ RETURN VALUE ⭐

Various. And listen β€” any value that comes back out of gearman_task_take_data() needs free(3) called on it. that means you. 😌


🏠 HOME 🏠

Want more info? Go here: http://gearman.info/ β€” the mothership, the blueprint, the source 🫢


🌈 SEE ALSO 🌈


πŸ“ Author πŸ“

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

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


aaaand that's the whole page bestie, we ate and left zero crumbs πŸ’…<br> this was gearmand 1.1.21+ds, dated Feb 04, 2026 β€” go submit a task, you got this πŸ‘‘βœ¨

πŸ“¦ where this page comes from