---
name: "gearman_task_send_workload"
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_task_send_workload"
---

# gearman\_task\_send\_workload(3)

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

## NAME

gearman\_task\_send\_workload - Gearmand Documentation, https://gearman.org/gearmand/

## SYNOPSIS

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

- **type gearman\_task\_st**

  - **void gearman\_task\_free(*gearman\_task\_st* \*task)**

  - **void \*gearman\_task\_context(const *gearman\_task\_st* \*task)**

  - **void gearman\_task\_set\_context(*gearman\_task\_st* \*task, void \*context)**

  - **const char \*gearman\_task\_function\_name(const *gearman\_task\_st* \*task)**

  - **const char \*gearman\_task\_unique(const *gearman\_task\_st* \*task)**

  - **const char \*gearman\_task\_job\_handle(const *gearman\_task\_st* \*task)**

  - ***bool* gearman\_task\_is\_known(const *gearman\_task\_st* \*task)**

  - ***bool* gearman\_task\_is\_running(const *gearman\_task\_st* \*task)**

  - ***uint32\_t* gearman\_task\_numerator(const *gearman\_task\_st* \*task)**

  - ***uint32\_t* gearman\_task\_denominator(const *gearman\_task\_st* \*task)**

  - **void gearman\_task\_give\_workload(*gearman\_task\_st* \*task, const void \*workload, *size\_t* workload\_size)**

  - ***size\_t* gearman\_task\_send\_workload(*gearman\_task\_st* \*task, const void \*workload, *size\_t* workload\_size, *gearman\_return\_t* \*ret\_ptr)**

  - **const void \*gearman\_task\_data(const *gearman\_task\_st* \*task)**

  - ***size\_t* gearman\_task\_data\_size(const *gearman\_task\_st* \*task)**

  - **void \*gearman\_task\_take\_data(*gearman\_task\_st* \*task, *size\_t* \*data\_size)**

  - ***size\_t* gearman\_task\_recv\_data(*gearman\_task\_st* \*task, void \*data, *size\_t* data\_size, *gearman\_return\_t* \*ret\_ptr)**

  - **const char \*gearman\_task\_error(const *gearman\_task\_st* \*task)**

  New in version 0.21.

- ***gearman\_return\_t* gearman\_task\_return(const *gearman\_task\_st* \*task)**

  New in version 0.21.

Link with -lgearman

## DESCRIPTION

A *gearman\_task\_st* represents a *task*.  Work that is sent by a *client* to a Gearman server is seen as a task (a *worker* receives a task in the form of a *job*.

Tasks, i.e. *gearman\_task\_st* are created by calling either *gearman\_execute()*, *gearman\_client\_add\_task()*, or *gearman\_client\_add\_task\_background()*. Note that, as of version 2.0.0, tasks are sent to the Gearman server in the order they are added, i.e., First-In, First-Out (FIFO) order. Prior to that release, the order was Last-In, First-Out (LIFO), but this was never a documented or guaranteed behavior.

*gearman\_client\_add\_task\_status()* can also create *gearman\_task\_st*, these tasks will be used to monitor a previously created *gearman\_task\_st*.

*gearman\_task\_free()* is used to free a task. This only needs to be done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task.

*gearman\_task\_set\_context()* sets the given context of the *gearman\_task\_st*. The context can be used to pass information to a *gearman\_task\_st*.

*gearman\_task\_context()* returns the context that was used in the creation of the *gearman\_task\_st* (or that was set with *gearman\_task\_set\_context()*.

*gearman\_task\_data()* returns the current data that has been returned to the task. *gearman\_task\_data\_size()* will give you the size of the value. *gearman\_task\_take\_data()* is the same as *gearman\_task\_data()* but the value that is returned must be freed by the client (**[free(3)](/free/3.md)**). *gearman\_task\_recv\_data()* can be used with pre-allocated buffers.

*gearman\_task\_is\_known()*, *gearman\_task\_is\_running()*, *gearman\_task\_numerator()*, and *gearman\_task\_denominator()*, return values related to the last status update that was made to the *gearman\_task\_st*. They do not cause the *gearman\_task\_st* to update itself.

*gearman\_task\_error()* return the last error message that the *gearman\_task\_st* encountered. *gearman\_task\_return()* return the last *gearman\_return\_t* stored. A value of *GEARMAN\_UNKNOWN\_STATE* means that the task has not been submitted to server yet, or that no function was available if the job has been submitted.

## RETURN VALUE

Various. Values that are returned by *gearman\_task\_take\_data()* must have **[free(3)](/free/3.md)** called on them.

## HOME

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

## SEE ALSO

**[gearmand(8)](/gearmand/8.md)** **[libgearman(3)](/libgearman/3.md)**

## AUTHOR

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

## COPYRIGHT

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