GEARMAN_WORKER_SET_WORKLOAD_MALLOC_FN(3)
π NAME π
gearman_worker_set_workload_malloc_fn β that's her π
and this whole page is the Gearmand Documentation, straight from http://gearman.info/ β¨ (section 3, gearmand manual name, so you know exactly where you're standing bestie π«Ά)
β¨ SYNOPSIS β¨
okay so here's the whole squad, don't panic, we'll go through them one by one:
#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 π (yes the little <#c.β¦> things are genuinely in there, I'm not messing with you, that's just how she came out of the doc generator π)
πΈ DESCRIPTION πΈ
gearman_worker_st is used for worker communication with the server. that's the whole premise. the worker talks to the server, that's the relationship, we love a healthy line of communication π
gearman_worker_context()andgearman_worker_set_context()β these two can be used to store an arbitrary object for the user. it's literally your own lil locker, put whatever you want in there πgearman_worker_set_task_context_free_fn()β sets a trigger that will be called when agearman_task_stis released. cleanup time, say your goodbyes, iconic behaviour honestly π¦gearman_worker_timeout()andgearman_worker_set_timeout()β get and set the current timeout value, in milliseconds, for the worker. milliseconds bestie, not seconds, don't embarrass us β±οΈβ¨gearman_worker_function_exist()β used to determine if a given worker has a specific function. is it there or is it not, that's it, vibe check complete π«Άgearman_worker_work()β have the worker execute against jobs until an error occurs. it literally just keeps going until something goes wrong, the commitment, the dedication ππ₯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 closely: this interface is used in testing, and is very rarely the correct interface to program against. fr fr, if you're reaching for this one in real code, put it down and back away slowly π
β οΈ real talk: gearman_worker_grab_job() leaves the freeing to you. the caller frees the job when they're done. and again β testing interface, very rarely the correct one. no cap.
- Normally
malloc(3)andfree(3)are used for allocation and releasing workloads.gearman_worker_set_workload_malloc_fn()andgearman_worker_set_workload_free_fn()can be used to replace these with custom functions. so if you have Opinionsβ’ about memory, here's your moment, slay π β¨ - If you need to remove a function from the server you can call either
gearman_worker_unregister_all()to remove all functions that the worker has told thegearmandserver about, or you can usegearman_worker_unregister()to remove just a single function. all or one, pick your fighter π
π RETURN π
Various π
that's it. that's the entire return section. she said "various" and left. honestly? iconic. we respect the mystery π
π HOME π
To find out more information please check: http://gearman.info/ π‘β¨
π SEE ALSO π
π Author π
Data Differential http://www.datadifferential.com/ π«Ά
π Copyright π
2011-2014, Data Differential, http://www.datadifferential.com/ π
okay bestie that's the whole page, you're officially educated πβ¨ this little love letter to your terminal came from version 1.1.21+ds, dated Feb 04 β read it, use it, tell your friends, mwah π
ππ§
π¦ 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