GEARMAN_CLIENT_SET_CREATED_FN(3)
β¨ NAME β¨
gearman_client_set_created_fn β it's a Gearmand thing, bestie π β all the deets live at http://gearman.info/ , and yes this whole page is under the GEARMAN_CLIENT_SET_CREATED_FN(3) entry in the Gearmand manual. π
π¦ SYNOPSIS π¦
#include <libgearman/gearman.h>
type gearman_actions_t
type gearman_workload_fn
type gearman_created_fn
type gearman_data_fn
type gearman_warning_fn
type gearman_universal_status_fn
type gearman_exception_fn
type gearman_fail_fn
type gearman_complete_fn
void gearman_client_set_workload_fn(gearman_client_st *client, gearman_workload_fn *function)
void gearman_client_set_created_fn(gearman_client_st *client, gearman_created_fn *function)
void gearman_client_set_data_fn(gearman_client_st *client, gearman_data_fn *function)
void gearman_client_set_warning_fn(gearman_client_st *client, gearman_warning_fn *function)
void gearman_client_set_status_fn(gearman_client_st *client, gearman_universal_status_fn *function)
void gearman_client_set_complete_fn(gearman_client_st *client, gearman_complete_fn *function)
void gearman_client_set_exception_fn(gearman_client_st *client, gearman_exception_fn *function)
void gearman_client_set_fail_fn(gearman_client_st *client, gearman_fail_fn *function)
void gearman_client_clear_fn(gearman_client_st *client)
const char *gearman_client_do_job_handle(gearman_client_st *client)
Link to -lgearman π (you gotta link it, no cap)
π DESCRIPTION π
Okay so, plot twist: these are the callbacks for client execution task states. Basically every time your client request goes through a state, you can have a little function go off. Iconic behaviour honestly. π
gearman_client_set_data_fn() sets the callback function that gets called if the server wants to make a request to the client asking for more data. It's giving "hey bestie, send more". π¨
gearman_client_do_job_handle() gets you the job handle for the running task. Use it between repeated gearman_client_do() (and its related calls) when you want to grab information. That's the whole vibe. π§
gearman_client_clear_fn() β call this when you want to remove all existing gearman_actions_t that have been set. Full reset, shadow-ban on your callbacks, periodt. π§Ή
Now the main group, and bestie there are a LOT of them, don't skip: gearman_client_set_created_fn(), gearman_client_set_data_fn(), gearman_client_set_warning_fn(), gearman_client_set_status_fn(), gearman_client_set_complete_fn(), gearman_client_set_exception_fn(), and gearman_client_set_fail_fn() β every single one of those sets a callback function for the different states of execution for a client request. And here's the crucial lore: each request, i.e. a creation of gearman_task_st, keeps a copy of the callbacks when it is created. So it's snapshotted, not referenced. Lowkey important. πΈ
Heads up bestie π¨:gearman_client_set_exception_fn()will ONLY be called if exceptions are enabled on the server. You turn that on by callinggearman_client_set_server_option().
An example of this:
const char *EXCEPTIONS="exceptions";
gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS));
πΈ RETURN VALUE πΈ
None. That's it. Nothing returned, we simply do not return things here. π
See also:
gearmand(8) libgearman(3) gearman_client_error(3) or gearman_worker_error(3)
π Author π
Data Differential β http://www.datadifferential.com/ π«Ά
π Copyright π
2011-2014, Data Differential, http://www.datadifferential.com/
and that's the whole page bestie β¨ version 1.1.21+ds, dated Feb 04, 2026 β go forth and set those callbacks, ily, 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