GEARMAN_WORKER_FUNCTION_EXIST(3)

✨ NAME ✨

gearman_worker_function_exist β€” Gearmand Documentation, <http://gearman.info/> 🫢

okay so bestie, welcome to the worker corner of libgearman πŸ’– this page is literally the whole "how do I be a worker" starter pack: context, timeouts, malloc hooks, registering functions, grabbing jobs. no cap, it's a lot, but we're gonna get through it together. periodt.


✨ 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)

Link with -lgearman

and when you link, it's -lgearman, don't forget it, she's essential bestie πŸ’…


✨ DESCRIPTION ✨

gearman_worker_st is the whole vibe β€” it's what a worker uses to talk to the server. like, that's the relationship. 🌸

gearman_worker_context() and gearman_worker_set_context() let you stash an arbitrary object of your own in there. it's your lil drawer. put whatever you want in it, the library will not judge πŸŽ€

gearman_worker_set_task_context_free_fn() sets a trigger β€” a lil callback situation β€” that gets called when a gearman_task_st <#c.gearman_task_st> is released. it's giving cleanup crew energy 🧹

gearman_worker_timeout() and gearman_worker_set_timeout() get and set the current timeout value in milliseconds for the worker. milliseconds, ok? not seconds. don't do seconds. that's how you end up confused at 3am 😭

gearman_worker_function_exist() is the main character of this page actually β€” it tells you whether a given worker has a specific function. yes/no, iconic, simple πŸ¦‹

gearman_worker_work() makes the worker just keep executing against jobs until an error occurs. it's the "run it and go" option, lowkey relentless πŸ”₯

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, bestie, nobody else is gonna do it. also ngl, this interface is used in testing, and it is very rarely the correct interface to program against. so like… iykyk. if you're reaching for this in real code, take a vibe check first πŸ™ˆ

normally malloc(3) and free(3) handle allocating and releasing workloads. but if you want your own setup, gearman_worker_set_workload_malloc_fn() and gearman_worker_set_workload_free_fn() swap those out for custom functions. build your own allocator era ✨

and if you ever need to remove a function from the server, you got two paths: gearman_worker_unregister_all() clears out all the functions the worker has told the gearmand server about, or gearman_worker_unregister() removes just one single function. mass unregister vs. targeted unregister, pick your fighter πŸ’…


✨ RETURN ✨

Various πŸŽ€


✨ HOME ✨

want more? go here, it's the mothership: <http://gearman.info/> πŸ’œ


✨ SEE ALSO ✨


✨ Author ✨

Data Differential <http://www.datadifferential.com/> πŸ‘‘

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


okay that's the whole page bestie, you ate it πŸ’– this was 1.1.21+ds, dated Feb 04, 2026, and it's the GEARMAN_WORKER_FUNCTION_EXIST(3) page β€” go register some functions and slay βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from