---
name: "gearman_client_do_background"
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_background"
---

# gearman\_client\_do\_background(3)

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

## NAME

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

## SYNOPSIS

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

- **type gearman\_priority\_t**

  - ***gearman\_return\_t* gearman\_client\_do\_background(*gearman\_client\_st* \*client, const char \*function\_name, const char \*unique, const void \*workload, *size\_t* workload\_size, char \*job\_handle)**

  Changed in version 0.21: *GEARMAN\_PAUSE* will no longer be returned. A do operation will now run until it has been submitted.

- ***gearman\_return\_t* gearman\_client\_do\_high\_background(*gearman\_client\_st* \*client, const char \*function\_name, const char \*unique, const void \*workload, *size\_t* workload\_size, *gearman\_job\_handle\_t* job\_handle)**

  - ***gearman\_return\_t* gearman\_client\_do\_low\_background(*gearman\_client\_st* \*client, const char \*function\_name, const char \*unique, const void \*workload, *size\_t* workload\_size, *gearman\_job\_handle\_t* job\_handle)**

  ## DESCRIPTION

*gearman\_client\_do\_background()* executes a single request to the gearmand server and returns the status via *gearman\_return\_t*.

*gearman\_client\_add\_task\_high\_background()* and *gearman\_client\_add\_task\_low\_background()* are identical to *gearman\_client\_do\_background()*, only they set the *gearman\_priority\_t* 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.

If job\_handle is not NULL, it will be populated with the name of the job\_handle for the task created. The job handle needs to be the size of *GEARMAN\_JOB\_HANDLE\_SIZE*. Please see *gearman\_job\_handle\_t* for more information.

## RETURN VALUE

*gearman\_return\_t*

## 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 <stdio.h>
#include <libgearman-1.0/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;
  }
  gearman_job_handle_t job_handle;
  gearman_return_t rc= gearman_client_do_background(client,
                                                    "reverse_function",
                                                    "unique_value",
                                                    "my string to reverse", strlen("my string to reverse"),
                                                    job_handle);
  if (gearman_success(rc))
  {
    // Make use of value
    printf("%s\n", job_handle);
  }
  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/
