GEARMAN_WORKER_WAIT(3)
β¨ gearman_worker_wait β¨ (the gearmand docs, section 3)
okay bestie, sit down, hydrate, and let's talk about gearman_worker_wait from the Gearmand docs π
this one lives at http://gearman.info/ and it's basically the whole worker-side vibe of libgearman in one page. no cap.
πΈ SYNOPSIS πΈ
first things first, you gotta pull in the header:
#include <libgearman/gearman.h>
and here's the whole cast of characters, exactly as advertised:
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)
Link with -lgearman
β οΈ bestie don't forget that last line β you have to Link with -lgearman or the linker will simply not know you π
π¦ DESCRIPTION π¦
gearman_worker_st is the whole β¨main characterβ¨ struct β it's what a worker uses to talk to the server. everything else on this page orbits around it.
gearman_worker_context()andgearman_worker_set_context()let you stash an arbitrary object of your very own in there. it's your drawer. put whatever you want in it. user data rights!! πgearman_worker_set_task_context_free_fn()sets up a trigger that gets called when agearman_task_st <#c.gearman_task_st>is released. it's giving cleanup crew π§Ήβ¨gearman_worker_timeout()andgearman_worker_set_timeout()get and set the current timeout value for the worker β and heads up, that value is in milliseconds. ms, babe. not seconds. π°οΈgearman_worker_function_exist()is your little detective π β you use it to figure out whether a given worker has a specific function.gearman_worker_work()makes the worker just execute against jobs until an error occurs. it goes and goes and goes until something goes wrong. periodt.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're done. no one's gonna do it for you, bestie π also, real talk: this interface is used in testing, and it is very rarely the correct interface to program against. so like... know that before you commit. ngl.- normally
malloc(3)andfree(3)handle allocating and releasing workloads. but if you want custom ones you can swap them out withgearman_worker_set_workload_malloc_fn()andgearman_worker_set_workload_free_fn(). bring your own allocator, it's fine, we support you π«Ά - and if you gotta remove a function from the server, you've got two roads:
gearman_worker_unregister_all()to nuke all the functions the worker told the gearmand server about π, orgearman_worker_unregister()to remove just one single function. precise. demure. π
β RETURN β
Various
yep. that's the whole answer. various. iconic, honestly. π
π HOME π
want more? go touch grass... no wait, go touch the docs: <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 little slice of the manual is version 1.1.21+ds, dated Feb 04, 2026, and it's still out here doing the most for GEARMAN_WORKER_WAIT(3) π¦β¨ go forth and register some functions, you got this π
π¦ 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