---
name: "gearman_client_set_context"
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_set_context"
---

# gearman\_client\_set\_context(3)

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

## NAME

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

## 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

## DESCRIPTION

Callbacks for client execution task states.

*gearman\_client\_set\_data\_fn()* sets the callback function that will be called if server is to make a request to the client to provide more data.

*gearman\_client\_do\_job\_handle()* gest the job handle for the running task. This should be used between repeated *gearman\_client\_do()* (and related) calls to get information.

*gearman\_client\_clear\_fn()* can be called to remove all existing *gearman\_actions\_t* that have been set.

*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()*, set callback functions for the different states of execution for a client request. Each request, ie a creation of *gearman\_task\_st*, keeps a copy of callbacks when it is created.

*gearman\_client\_set\_exception\_fn()* will only be called if exceptions are enabled on the server. You can do this by calling **gearman\_client\_set\_server\_option()**.

An example of this:

```
const char *EXCEPTIONS="exceptions";
gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS));
```

## RETURN VALUE

None

**SEE ALSO:**

**[gearmand(8)](/gearmand/8.md)** **[libgearman(3)](/libgearman/3.md)** **[gearman\_client\_error(3)](/gearman_client_error/3.md)** or **[gearman\_worker\_error(3)](/gearman_worker_error/3.md)**

## AUTHOR

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

## COPYRIGHT

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