GEARMAN_CLIENT_CREATE(3)
π GEARMAN_CLIENT_CREATE π
okay bestie, pull up a chair π«Ά this is the libgearman manual, section 3, and today's main character is gearman_client_create β the one that makes your client struct exist in the first place.
β¨ NAME β¨
gearman_client_create β Gearmand Documentation, <http://gearman.info/>
Just to be clear: that's the official Gearmand documentation link, not me being cute. (I'm also being cute. Both things are true.)
π SYNOPSIS π
#include <libgearman/gearman.h>
gearman_client_st <#c.gearman_client_st>
*gearman_client_create(gearman_client_st <#c.gearman_client_st> *client)
gearman_client_st <#c.gearman_client_st>
*gearman_client_clone(gearman_client_st <#c.gearman_client_st> *client,
const gearman_client_st <#c.gearman_client_st> *from)
void gearman_client_free(gearman_client_st <#c.gearman_client_st>
*client)
Link with -lgearman
bestie the<#c.gearman_client_st>bits are literally just how the docs mark up that cross-reference to thegearman_client_sttype β do not type those into your compiler or she WILL yell at you π
π¦ DESCRIPTION π¦
gearman_client_create() is your origin story, fr fr π
it creates a c:type:gearman_client_st structure that every other libgearman client function will use to talk to the server. So like, nothing else works until you've done this. Main character energy only.
You've got two ways to do it, and you must pick one:
- hand it a statically declared
gearman_client_st <#c.gearman_client_st>that you already have lying around, or - hand it a
NULL.
If you pass in a NULL, the structure gets allocated for you. β¨
gearman_client_clone() is giving very much "create but with receipts" π it copies the defaults and the list of servers from the source gearman_client_st <#c.gearman_client_st>. Two fun edge cases for you:
- If you pass a
NULLas the argument for the source to clone, it's exactly the same as a call togearman_client_create. - If the destination argument is
NULL, agearman_client_st <#c.gearman_client_st>will be allocated for you.
And then when you're done slaying? To clean up the memory associated with a gearman_client_st <#c.gearman_client_st> structure, you should pass it to gearman_client_free once you're finished with it. Not optional, babes β gearman_client_free() is the only way to make sure all memory is deallocated when you finish using the structure. π
π¨ Warning π¨
You may wish to avoid usinggearman_client_create()orgearman_client_clone()with a stack based allocation, i.e. the first parameter. The most common issues related to ABI safety involve stack allocated structures.
ngl, this one's the realest part of the whole page β stack allocation here is the vibe killer π ABI safety issues live there. Heed it.
π RETURN VALUE π
gearman_client_createreturns a pointer to thegearman_client_stthat was created (or initialized). On an allocation failure, it returnsNULL.gearman_client_clonereturns a pointer to thegearman_client_stthat was created (or initialized). On an allocation failure, it returnsNULL.
So: pointer = slay, NULL = allocation said no π
π HOME π
To find out more information please check: <http://gearman.info/>
See also:
gearmand(8) libgearman(3) gearman_strerror(3) gearman_client_st(3)
Author
Data Differential <http://www.datadifferential.com/>
Copyright
2011-2014, Data Differential, <http://www.datadifferential.com/>
and that's the tea, bestie π this edition is 1.1.21+ds, dated Feb 04, 2026, and it goes by GEARMAN_CLIENT_CREATE(3) around these parts π go forth and gearman_client_free your stuff, i'm obsessed with you π
π¦ 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