GEARMAN_WORKER_CLONE(3)
π¦ GEARMAN_WORKER_CLONE π¦
okay so bestie, you're looking at GEARMAN_WORKER_CLONE(3) β that's section 3 of the Gearmand manual, the library-functions section. This page is literally The Clone Page π
but it also covers the create/free triplets because they're a package deal. Let's go.
πΈ NAME πΈ
gearman_worker_clone β Gearmand Documentation, http://gearman.info/
β¨ SYNOPSIS β¨
#include <libgearman/gearman.h>
gearman_worker_st <#c.gearman_worker_st>
*gearman_worker_create(gearman_worker_st <#c.gearman_worker_st> *client)
gearman_worker_st <#c.gearman_worker_st>
*gearman_worker_clone(gearman_worker_st <#c.gearman_worker_st> *client,
const gearman_worker_st <#c.gearman_worker_st> *from)
void gearman_worker_free(gearman_worker_st <#c.gearman_worker_st>
*client)
Link with -lgearman
you already know this but: link the library or the linker will simply not speak to you π
π DESCRIPTION π
gearman_worker_create() is the function you use to create a gearman_worker_st structure, and once it exists, all the other libgearman(3) client functions use it to talk to the server. You've got two options going in: hand it a statically declared gearman_worker_st, or hand it a NULL. Pass in NULL and a structure gets allocated for you, king behavior. π
gearman_worker_clone() is giving sibling energy to gearman_worker_create() β it does the same kind of thing, except on top of that it copies the defaults and the list of servers over from the source gearman_worker_st. And if you pass a null as the argument for the source you're cloning from? That's literally identical to just calling gearman_worker_create(). And if the destination argument is NULL, a gearman_worker_st gets allocated for you. No cap.
Now, memory. To clean up everything hanging off a gearman_worker_st structure, you pass it to gearman_worker_free() once you're done with it. And listen β gearman_worker_free is the only way to make sure all that memory is actually deallocated when you finish using the structure. Not optional, bestie. Skipping it is how you leak. π
One more tea: you may wish to avoid using gearman_worker_create() or gearman_worker_clone() with a stack based allocation, i.e. that first parameter. The most common issues related to ABI safety involve heap allocated structures. So like, heap is the vibe, stack is where the jump scares live. π
also lol, the OG page literally types gearman_worker_create) with a stray closing paren in the middle of a sentence. We do not fix the ancestors, we simply honor them. π
π RETURN VALUE π
gearman_worker_create()β returns a pointer to thegearman_worker_stthat was created (or initialized). If the allocation fails, it returnsNULL.gearman_worker_clone()β returns a pointer to thegearman_worker_stthat was created (or initialized). If the allocation fails, it returnsNULL.
so basically: pointer = slay, NULL = check your allocation, bestie. β¨
π HOME π
To find out more information please check: http://gearman.info/
See also:
π Author π
Data Differential http://www.datadifferential.com/
π Copyright π
2011-2014, Data Differential, http://www.datadifferential.com/
and that's the page!! π«Ά source/version is 1.1.21+ds, it's dated Feb 04, 2026, and it belongs to GEARMAN_WORKER_CLONE(3). go forth and clone responsibly, bestie ππ§π
π¦ 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