GEARMAN_WORKER_GRAB_JOB(3)

πŸ’– GEARMAN_WORKER_GRAB_JOB πŸ’–

okay bestie, this is the manual page for gearman_worker_grab_job (that's the section 3 one, library-call vibes only, we're in GEARMAN_WORKER_GRAB_JOB(3) territory πŸŽ€). Grab a strawberry πŸ“, sit down, and let's get into it.


✨ NAME ✨

gearman_worker_grab_job β€” Gearmand Documentation, <http://gearman.info/> πŸ’…


✨ 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 you link it all together, obviously:

Link with -lgearman

🌸 DESCRIPTION 🌸

gearman_worker_st is the whole data type you use for a worker talking to the server. it's giving main character energy fr fr πŸ‘‘

gearman_worker_context() and gearman_worker_set_context() are your little hiding spot πŸ’… β€” you can stash an arbitrary object in there for the user, no questions asked.

gearman_worker_set_task_context_free_fn() sets a trigger that gets called whenever a gearman_task_st is released. like a lil "we're done here" notification 🌈

gearman_worker_timeout() and gearman_worker_set_timeout() get and set the current timeout value for the worker β€” and heads up, that number is in milliseconds ⏱️

gearman_worker_function_exist() is the vibe check for whether a given worker has a specific function. yes/no, iconic behavior, no cap πŸ”₯

gearman_worker_work() has the worker execute against jobs until an error occurs. it just keeps going and going 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. don't leave that job hanging, bestie, that's a leak 🫢

⚠️ also real talk: this interface is used in testing, and is very rarely the correct interface to program against. like it's a niche lil thing, iykyk πŸ’€

normally malloc(3) and free(3) are used for allocating and releasing workloads. but if you're feeling fancy, gearman_worker_set_workload_malloc_fn() and gearman_worker_set_workload_free_fn() let you swap those out for custom functions. your memory, your rules ✨

and if you ever need to remove a function from the server, you've got options, bestie:

  • call gearman_worker_unregister_all() to remove all the functions that the worker has told the gearmand server about 🌈
  • or use gearman_worker_unregister() to remove just a single function πŸŽ€

πŸ’« RETURN πŸ’«

Various. (yes that's literally it, the page said "Various" and we respect the mystery πŸ™ˆ)


πŸ¦‹ HOME πŸ¦‹

want more info? go here, bestie: <http://gearman.info/>


πŸ‘‘ SEE ALSO πŸ‘‘


πŸŽ€ Author

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

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


and that's the whole page!! version 1.1.21+ds, dated Feb 04, 2026 β€” slay, go free your jobs, mwah πŸ’–βœ¨πŸ’…

πŸ“¦ where this page comes from