GEARMAN_CLIENT_SET_WORKLOAD_FREE_FN(3)
π GEARMAN_CLIENT_SET_WORKLOAD_FREE_FN β bestie edition
okay so. we're in the Gearmand Documentation section of the manual (the whole thing lives at http://gearman.info/ btw π«Ά), and today's topic is gearman_client_set_workload_free_fn β plus a whole lil friend group of related functions that all hang out in the same header. buckle up, it's giving very much "one page, many functions." β¨
πΈ SYNOPSIS πΈ
#include <libgearman/gearman.h>
type gearman_client_st
type gearman_task_context_free_fn
int gearman_client_timeout(gearman_client_st *client)
void gearman_client_set_timeout(gearman_client_st *client, int timeout)
void *gearman_client_context(const gearman_client_st *client)
void gearman_client_set_context(gearman_client_st *client, void *context)
void gearman_client_set_workload_malloc_fn(gearman_client_st *client,
gearman_malloc_fn *function, void *context)
void gearman_client_set_workload_free_fn(gearman_client_st *client,
gearman_free_fn *function, void *context)
void gearman_client_task_free_all(gearman_client_st *client)
void gearman_client_set_task_context_free_fn(gearman_client_st *client,
gearman_task_context_free_fn *function)
π¨ heads up bestie: bothgearman_client_set_workload_malloc_fnandgearman_client_set_workload_free_fnare Deprecated since version 0.23 β usegearman_allocator_tinstead. the vibes are "please stop using me" π
and when you compile, link with:
-lgearman
β¨ DESCRIPTION β¨
so like, gearman_client_st is the whole personality of client <#term-client> communication with the server. it's the main character. π
gearman_client_context() and gearman_client_set_context() let you stash an arbitrary object for the user β like a lil locker at the gym, except it's your own stuff and the library doesn't touch it. yk? π
gearman_client_set_task_context_free_fn() sets a trigger β a function that fires when a gearman_task_st gets released. think of it as the "clean up after yourself" bestie. π§Ήπ
gearman_client_timeout() and gearman_client_set_timeout() get and set the current connection timeout value, in milliseconds, for the client. no cap, milliseconds. β±οΈ
normally, malloc(3) and free(3) handle allocation and releasing of workloads. but gearman_client_set_workload_malloc_fn() and gearman_client_set_workload_free_fn() can swap those out for custom functions. however β these have been deprecated, so please, for the love of everything, look at gearman_allocator_t for the updated interface. it's the glow-up. π
gearman_client_task_free_all() frees ALL current gearman_task_st that were created with the gearman_client_st. every single one. it's thorough like that. π₯
β οΈ Warning: if you callgearman_client_task_free_all(), you can end up with a SEGFAULT if you then try to use anygearman_task_stwhose pointer you kept around. do NOT hold onto those pointers and then poke them. this is not a drill, this is literally undefined chaos. π
π RETURN VALUE π
gearman_client_timeout() returns an integer that represents how many milliseconds it'll wait for a connection before throwing an error. and if you see a value of -1, that means an infinite timeout value β no clock, just vibes, waiting forever. β³β¨
π HOME π
for more info, please check: <http://gearman.info/>
See also:
π Author
Data Differential http://www.datadifferential.com/
π Copyright
2011-2014, Data Differential, http://www.datadifferential.com/
that's the whole page bestie, ily, go write some slay client code π«Άπ β this was version 1.1.21+ds, dated Feb 04, 20β¦ (the year got a lil cut off, iconic behavior tbh), brought to you by the GEARMAN_CLIENT...ORKLOAD_FREE_FN(3) page. periodt. β¨
π¦ 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