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() and gearman_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 a gearman_task_st is released. cleanup time, say your goodbyes, iconic behaviour honestly πŸ¦‹
  • gearman_worker_timeout() and gearman_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) and free(3) are used for allocation and releasing workloads. gearman_worker_set_workload_malloc_fn() and gearman_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 the gearmand server about, or you can use gearman_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/ 🫢

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