---
name: "gearman_client_timeout"
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_client_timeout"
---

# gearman\_client\_timeout(3)

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

## NAME

gearman\_client\_timeout - Gearmand Documentation, https://gearman.org/gearmand/

## SYNOPSIS

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

- **type gearman\_client\_st**

  - **type gearman\_task\_context\_free\_fn**

  - **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)**

  Link with -lgearman

## DESCRIPTION

*gearman\_client\_st* is used for *client* communication with the server.

*gearman\_client\_context()* and *gearman\_client\_set\_context()* can be used to store an arbitrary object for the user.

*gearman\_client\_set\_task\_context\_free\_fn()* sets a trigger that will be called when a *gearman\_task\_st* is released.

*gearman\_client\_timeout()* and *gearman\_client\_set\_timeout()* get and set the current connection timeout value, in milliseconds, for the client.

Normally **[malloc(3)](/malloc/3.md)** and **[free(3)](/free/3.md)** are used for allocation and releasing workloads. *gearman\_client\_set\_workload\_malloc\_fn()* and *gearman\_client\_set\_workload\_free\_fn()* can be used to replace these with custom functions. (These have been deprecated, please see *gearman\_allocator\_t* for the updated interface.

*gearman\_client\_task\_free\_all()* is used to free all current *gearman\_task\_st* that have been created with the *gearman\_client\_st*.

**WARNING:**

By calling *gearman\_client\_task\_free\_all()* you can end up with a SEGFAULT if you try to use any *gearman\_task\_st* that you have kept pointers too.

## RETURN VALUE

*gearman\_client\_timeout()* returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of -1 means an infinite timeout value.

## 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\_client\_create(3)](/gearman_client_create/3.md)**

## AUTHOR

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

## COPYRIGHT

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