GEARMAN_WORKER_SET_TIMEOUT(3)

πŸ’– NAME πŸ’–

gearman_worker_set_timeout β€” Gearmand Documentation, http://gearman.info/

okay bestie, so we're in GEARMAN_WORKER_SET_TIMEOUT(3) territory and honestly? this page is a whole vibe. it's less "one function" and more "the entire worker life, served on a platter" ✨


🌈 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, the moment you've been waiting for β€” Link with -lgearman 🫢 that's it, that's the link line, go link it.


✨ DESCRIPTION ✨

so gearman_worker_st is the whole thing your worker uses to yap with the server. main character struct energy fr fr πŸ‘‘

  • gearman_worker_context() and gearman_worker_set_context() let you stash an arbitrary object for the user. a lil pocket for your stuff πŸ’…
  • gearman_worker_set_task_context_free_fn() sets a trigger that gets called when a gearman_task_st is released. like a little goodbye party for your task πŸŽ€
  • 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() is how you check whether a given worker actually 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 and going until something breaks πŸ’€ iconic honestly
  • gearman_worker_grab_job() takes a job from one of the job servers. the caller is responsible for freeing the job once they're done β€” yes YOU, it's your job to free the job, no cap. also worth knowing: this interface is used in testing, and is very rarely the correct interface to program against. so like. it's giving "for the girlies who know" πŸ™ˆ
  • normally malloc(3) and free(3) handle allocation and releasing workloads. if you want different ones, gearman_worker_set_workload_malloc_fn() and gearman_worker_set_workload_free_fn() will swap in your custom functions. build-a-bear but for memory 🧸
  • need to ghost a function on the server? you've got options, bestie:
    • gearman_worker_unregister_all() β€” removes all the functions the worker has told the gearmand server about. scorched earth, we love a clean slate πŸ”₯
    • gearman_worker_unregister() β€” removes just a single function. surgical. precise. slay πŸ’…

🌸 RETURN 🌸

Various

(that's genuinely it. the return values said "Various" and honestly? relatable, same, me too 😭)


πŸ¦‹ HOME πŸ¦‹

To find out more information please check: http://gearman.info/

go, run, don't walk πŸƒβ€β™€οΈβœ¨


⭐ SEE ALSO ⭐


πŸ‘‘ AUTHOR πŸ‘‘

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

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


and that's the whole page, bestie! this was sitting in version 1.1.21+ds, dated Feb 04, 2026 β€” so like, recent recent. go forth and set those timeouts in milliseconds πŸ’–βœ¨πŸ«Ά

πŸ“¦ where this page comes from