GEARMAN_CLIENT_CONTEXT(3)
π GEARMAN_CLIENT_CONTEXT π
okay bestie, gather round, because this is the gearmand documentation situation and we're doing it together. Like, this is the manual page for gearman_client_context, and yes it's giving very much "library internals" but honestly? kinda iconic. let's go. π¦
β¨ NAME β¨
gearman_client_context β Gearmand Documentation, the whole vibe lives at <http://gearman.info/> π
πΈ SYNOPSIS πΈ
first things first, you gotta pull in the header, no cap:
#include <libgearman/gearman.h>
then we've got the types, the β¨ core cast β¨ of this whole drama:
type gearman_client_st
type gearman_task_context_free_fn
and now the functions, one by one, no skips, no shortcuts:
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)
Deprecated since version 0.23: Use gearman_allocator_t
void gearman_client_set_workload_free_fn(gearman_client_st *client,
gearman_free_fn *function, void *context)
Deprecated since version 0.23: Use gearman_allocator_t
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)
and when you build, you link with -lgearman, that's the whole thing π
ngl notice howgearman_client_set_workload_malloc_fn()andgearman_client_set_workload_free_fn()are deprecated since version 0.23 β for both of them, the move isgearman_allocator_tinstead. the old interface is still there but it's giving "we've moved on". π«Ά
π DESCRIPTION π
so gearman_client_st is the whole reason we're here β it's what you use for client communication with the server. that's the job. that's the assignment. slay. β¨
gearman_client_context() and gearman_client_set_context() are your little storage cubbies β they let you stash an arbitrary object for the user. literally whatever you want in there, that's between you and your code. π
gearman_client_set_task_context_free_fn() sets up a trigger that gets called when a gearman_task_st is released. so like, a callback for the moment the task says bye. π¦
gearman_client_timeout() and gearman_client_set_timeout() get and set the current connection timeout value, in milliseconds, for the client. get it, set it, that's the dynamic duo. πΈ
now, normally malloc(3) and free(3) handle allocating and releasing workloads. gearman_client_set_workload_malloc_fn() and gearman_client_set_workload_free_fn() exist so you can swap those out for your own custom functions. but β and this is the important part, bestie β those two have been deprecated, so please go look at gearman_allocator_t for the updated interface. do not skip that part. π
gearman_client_task_free_all() frees all the current gearman_task_st that have been created with the gearman_client_st. all of them. every last one. β
Warning: β οΈ if you callgearman_client_task_free_all(), you can end up with a SEGFAULT if you try to use anygearman_task_stthat you've kept pointers to. like, they're freed now. the pointers are stale. touching them is a bad time. this is not a drill, this is the flirty little footnote that will ruin your whole afternoon. π
π RETURN VALUE π
gearman_client_timeout() returns an integer, and that integer represents the amount of time in milliseconds to wait for a connection before throwing an error. β³
and get this β a value of -1 means an infinite timeout value. forever. no clock. main character energy fr fr. π
π HOME π
to find out more information please check: <http://gearman.info/>
See also:
like, go read those too, they're all part of the same friend group π«Ά
π Author π
Data Differential <http://www.datadifferential.com/>
πΈ Copyright πΈ
2011-2014, Data Differential, <http://www.datadifferential.com/>
and that's the whole page, bestie!! you understood it, you ate, no crumbs. π β¨
this was version 1.1.21+ds, dated Feb 04, 2026, and it lives under the name GEARMAN_CLIENT_CONTEXT(3) so you can find it again whenever you need it. 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