GEARMAN_WORKER_REGISTER(3)
π GEARMAN_WORKER_REGISTER π
okay bestie, gather round, because this is the gearmand manual page for GEARMAN_WORKER_REGISTER(3) and it is literally the blueprint for making your worker actually do stuff. no cap. π«Ά
β¨ NAME β¨
gearman_worker_register β the Gearmand Documentation, and yes it lives at <http://gearman.info/> πΈ
π SYNOPSIS π
first things first, you gotta pull in the header, periodt:
#include <libgearman/gearman.h>
and here's the whole cast of characters, fr fr: π
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 when you link it, you link it like this, don't forget it bestie:
Link with -lgearman
π¦ DESCRIPTION π¦
so gearman_worker_st is the whole vibe β it's what your worker uses to talk to the server. that's it, that's the friendship. π
gearman_worker_context() and gearman_worker_set_context() let you stash an arbitrary object in there for the user. your stuff, your rules, keep it cozy. π§Ί
gearman_worker_set_task_context_free_fn() sets a trigger that gets called when a gearman_task_st <#c.gearman_task_st> is released. like a lil cleanup fairy. π§
gearman_worker_timeout() and gearman_worker_set_timeout() get and set the current timeout value in milliseconds, for the worker. milliseconds bestie, not seconds, do not play yourself. β±οΈ
gearman_worker_function_exist() tells you whether a given worker has a specific function. vibe check, but for functions. β
gearman_worker_work() has the worker execute against jobs until an error occurs. it just keeps going, main character energy, 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. that's on you. π«΅
not me being dramatic but: this interface is used in testing, and is very rarely the correct interface to program against. so likeβ¦ know that going in. π
normally malloc(3) and free(3) handle allocation and releasing workloads. but if you wanna be fancy, gearman_worker_set_workload_malloc_fn() and gearman_worker_set_workload_free_fn() can replace those with custom functions. custom fit, tailored, iconic. β¨
and if you need to remove a function from the server, you've got two doors: call gearman_worker_unregister_all() to remove all functions that the worker has told the gearmand server about, or use gearman_worker_unregister() to remove just a single function. one at a time or the whole roster, your call. π―
π RETURN π
Various. (yes really, that's the whole thing. slay, i guess. π)
π HOME π
to find out more information please check: <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, no notes. this was 1.1.21+ds, dated Feb 04, 2026, straight out of the Gearmand source β go forth and register those functions, you absolute icon. π
β¨π
π¦ 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