---
name: "gearman_worker_create"
section: "3"
platform: "linux"
package: "gearmand"
version: "2.2.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/gearman_worker_create"
---

# gearman\_worker\_create(3)

Gearmand Documentation, https://gearman.org/gearmand/

## NAME

gearman\_worker\_create - Gearmand Documentation, https://gearman.org/gearmand/

## SYNOPSIS

\#include \<libgearman/gearman.h\>

- ***gearman\_worker\_st* \*gearman\_worker\_create(*gearman\_worker\_st* \*client)**

  - ***gearman\_worker\_st* \*gearman\_worker\_clone(*gearman\_worker\_st* \*client, const *gearman\_worker\_st* \*from)**

  - **void gearman\_worker\_free(*gearman\_worker\_st* \*client)**

  Link with -lgearman

## DESCRIPTION

gearman\_worker\_create() is used to create a *gearman\_worker\_st*  structure that will then be used by other [libgearman(3)](/libgearman/3.md) client functions to communicate with the server. You should either pass a statically declared *gearman\_worker\_st*  to gearman\_worker\_create) or a NULL. If a NULL passed in then a structure is allocated for you.

*gearman\_worker\_clone()* is similar to *gearman\_worker\_create()* but it copies the defaults and list of servers from the source *gearman\_worker\_st*. If you pass a null as the argument for the source to clone, it is the same as a call to gearman\_worker\_create(). If the destination argument is NULL a *gearman\_worker\_st*  will be allocated for you.

To clean up memory associated with a *gearman\_worker\_st*  structure you should pass it to *gearman\_worker\_free()* when you are finished using it. *gearman\_worker\_free* is the only way to make sure all memory is deallocated when you finish using the structure.

You may wish to avoid using *gearman\_worker\_create()* or *gearman\_worker\_clone()* with a stack based allocation, ie the first parameter. The most common issues related to ABI safety involve heap allocated structures.

## RETURN VALUE

*gearman\_worker\_create()* returns a pointer to the *gearman\_worker\_st* that was created (or initialized). On an allocation failure, it returns NULL.

*gearman\_worker\_clone()* returns a pointer to the *gearman\_worker\_st* that was created (or initialized). On an allocation failure, it returns NULL.

## HOME

To find out more information please check: *https://gearman.org/gearmand/*

**SEE ALSO:**

**[gearmand(8)](/gearmand/8.md)** **[libgearman(3)](/libgearman/3.md)** **[gearman\_strerror(3)](/gearman_strerror/3.md)**

## AUTHOR

Data Differential http://www.datadifferential.com/

## COPYRIGHT

2011-2014, Data Differential, http://www.datadifferential.com/
