---
name: "gearman_client_do"
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_do"
---

# gearman\_client\_do(3)

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

## NAME

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

## SYNOPSIS

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

- **void \*gearman\_client\_do(*gearman\_client\_st* \*client, const char \*function\_name, const char \*unique, const void \*workload, *size\_t* workload\_size, *size\_t* \*result\_size, *gearman\_return\_t* \*ret\_ptr)**

  Changed in version 0.21: *GEARMAN\_PAUSE* will no longer be returned. A do operation will now run till completion or error.

- **void \*gearman\_client\_do\_high(*gearman\_client\_st* \*client, const char \*function\_name, const char \*unique, const void \*workload, *size\_t* workload\_size, *size\_t* \*result\_size, *gearman\_return\_t* \*ret\_ptr)**

  - **void \*gearman\_client\_do\_low(*gearman\_client\_st* \*client, const char \*function\_name, const char \*unique, const void \*workload, *size\_t* workload\_size, *size\_t* \*result\_size, *gearman\_return\_t* \*ret\_ptr)**

  ## DESCRIPTION

*gearman\_client\_do()* executes a single request to the gearmand server and waits for a reply.

*gearman\_client\_do\_high()* and *gearman\_client\_do\_low()* are identical to *gearman\_client\_do()*, only they set the priority to either high or low.

Job assignment priority is global across registered functions. A high priority job for any function is assigned before normal or low priority jobs for other functions.

All of the functions will block until either a response or an error is returned.

## RETURN VALUE

*gearman\_client\_do()* returns a pointer to a value that the caller must release. If ret\_ptr is provided any errors that have occurred will be stored in it. Since a NULL/zero value is a valid value, you will always need to check ret\_ptr if you are concerned with errors.

## EXAMPLE

```
/*
# Gearman server and library
# Copyright (C) 2012 Data Differential, http://datadifferential.com/
# All rights reserved.
#
# Use and distribution licensed under the BSD license.  See
# the COPYING file in this directory for full text.
*/
#include <string.h>
#include <stdlib.h>
#include <libgearman/gearman.h>
int main(void)
{
  gearman_client_st *client= gearman_client_create(NULL);
  gearman_return_t ret= gearman_client_add_server(client, "localhost", 0);
  if (gearman_failed(ret))
  {
    return EXIT_FAILURE;
  }
  size_t result_size;
  gearman_return_t rc;
  void *value= gearman_client_do(client, "reverse_function", "unique_value",
                                 "my string to reverse", strlen("my string to reverse"),
                                 &result_size, &rc);
  if (gearman_success(rc))
  {
    // Make use of value
  }
  free(value);
  gearman_client_free(client);
  return 0;
}
```

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