GEARMAN_WORKER_GRAB_JOB(3)
π GEARMAN_WORKER_GRAB_JOB π
okay bestie, this is the manual page for gearman_worker_grab_job (that's the section 3 one, library-call vibes only, we're in GEARMAN_WORKER_GRAB_JOB(3) territory π). Grab a strawberry π, sit down, and let's get into it.
β¨ NAME β¨
gearman_worker_grab_job β Gearmand Documentation, <http://gearman.info/> π
β¨ SYNOPSIS β¨
#include <libgearman/gearman.h>
type gearman_worker_st
type gearman_worker_set_task_context_free_fn
int gearman_worker_timeout(gearman_worker_st *worker)
void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout)
void *gearman_worker_context(const gearman_worker_st *worker)
void gearman_worker_set_context(gearman_worker_st *worker, void
*context)
void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker,
gearman_malloc_fn <#c.gearman_malloc_fn> *function, void *context)
void gearman_worker_set_workload_free_fn(gearman_worker_st *worker,
gearman_free_fn <#c.gearman_free_fn> *function, void *context)
gearman_return_t <#c.gearman_return_t>
gearman_worker_wait(gearman_worker_st *worker)
gearman_return_t <#c.gearman_return_t>
gearman_worker_register(gearman_worker_st *worker, const char
*function_name, uint32_t <#c.uint32_t> timeout)
gearman_return_t <#c.gearman_return_t>
gearman_worker_unregister(gearman_worker_st *worker, const char
*function_name)
gearman_return_t <#c.gearman_return_t>
gearman_worker_unregister_all(gearman_worker_st *worker)
void gearman_job_free_all(gearman_worker_st *worker)
bool gearman_worker_function_exist(gearman_worker_st *worker, const char
*function_name, size_t <#c.size_t> function_length)
gearman_return_t <#c.gearman_return_t>
gearman_worker_work(gearman_worker_st *worker)
gearman_job_st <#c.gearman_job_st>
*gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st <#c
.gearman_job_st> *job, gearman_return_t <#c.gearman_return_t> *ret_ptr)
and then you link it all together, obviously:
Link with -lgearman
πΈ DESCRIPTION πΈ
gearman_worker_st is the whole data type you use for a worker talking to the server. it's giving main character energy fr fr π
gearman_worker_context() and gearman_worker_set_context() are your little hiding spot π
β you can stash an arbitrary object in there for the user, no questions asked.
gearman_worker_set_task_context_free_fn() sets a trigger that gets called whenever a gearman_task_st is released. like a lil "we're done here" notification π
gearman_worker_timeout() and gearman_worker_set_timeout() get and set the current timeout value for the worker β and heads up, that number is in milliseconds β±οΈ
gearman_worker_function_exist() is the vibe check for whether a given worker has a specific function. yes/no, iconic behavior, no cap π₯
gearman_worker_work() has the worker execute against jobs until an error occurs. it just keeps going and going until something goes wrong π
gearman_worker_grab_job() takes a job from one of the job servers. and listen β it is the responsibility of the caller to free the job once they are done. don't leave that job hanging, bestie, that's a leak π«Ά
β οΈ also real talk: this interface is used in testing, and is very rarely the correct interface to program against. like it's a niche lil thing, iykyk π
normally malloc(3) and free(3) are used for allocating and releasing workloads. but if you're feeling fancy, gearman_worker_set_workload_malloc_fn() and gearman_worker_set_workload_free_fn() let you swap those out for custom functions. your memory, your rules β¨
and if you ever need to remove a function from the server, you've got options, bestie:
- call
gearman_worker_unregister_all()to remove all the functions that the worker has told thegearmandserver about π - or use
gearman_worker_unregister()to remove just a single function π
π« RETURN π«
Various. (yes that's literally it, the page said "Various" and we respect the mystery π)
π¦ HOME π¦
want more info? go here, bestie: <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!! version 1.1.21+ds, dated Feb 04, 2026 β slay, go free your jobs, mwah πβ¨π
π¦ 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