GEARMAN_WORKER_CONTEXT(3)

πŸ’– NAME πŸ’–

okay so welcome to the GEARMAN_WORKER_CONTEXT(3) page β€” that's the Gearmand manual, section 3, for all my Unix besties out there. ✨


🌈 SYNOPSIS 🌈

bestie, here's the whole cast list, verbatim, no edits, no notes:

#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 yes, when you link your program you gotta link it with -lgearman, that's not optional bestie πŸ’…

✨ DESCRIPTION ✨

okay so the gearman_worker_st type is literally the whole reason we're here β€” it's what a worker uses to communicate with the server. main character behavior fr.

gearman_worker_context() and gearman_worker_set_context() are your little secret pocket 🫢 β€” you can use them to store an arbitrary object for the user. whatever you want, it's yours.

gearman_worker_set_task_context_free_fn() sets a trigger that will be called when a gearman_task_st <#c.gearman_task_st> is released. set it up once and it goes off on its own, no cap.

gearman_worker_timeout() and gearman_worker_set_timeout() get and set the current timeout value, in milliseconds, for the worker. getter and setter, a matched pair, iconic.

gearman_worker_function_exist() is how you determine if a given worker has a specific function. vibe check on the worker's abilities ✨

gearman_worker_work() have the worker execute against jobs until an error occurs. it's giving "go until something breaks" 🫠

gearman_worker_grab_job() takes a job from one of the job servers. it is the responsibility of the caller to free the job once they are done. and listen β€” this interface is used in testing, and is very rarely the correct interface to program against. so like, know that before you commit πŸ™ˆ

normally malloc(3) and free(3) are used for allocation and releasing workloads. but if you wanna be different πŸ’…, gearman_worker_set_workload_malloc_fn() and gearman_worker_set_workload_free_fn() can be used to replace these with custom functions. custom allocations? obsessed.

if you need to remove a function from the server you've got two options, and this is the choose-your-own-adventure part:

  • 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 🎯

πŸŽ€ RETURN πŸŽ€

Various

(that's it. that's the whole section. short king πŸ‘‘)


🏠 HOME 🏠

to find out more information please check: <http://gearman.info/>


πŸ‘€ SEE ALSO πŸ‘€


πŸ–ŠοΈ Author πŸ–ŠοΈ

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


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


and that's the page bestie!! 🌸 this was GEARMAN_WORKER_CONTEXT(3) from the Gearmand manual, version 1.1.21+ds, dated Feb 04, 2026. go forth and register your workers, ily, periodt πŸ’–πŸ¦‹

πŸ“¦ where this page comes from