GEARMAN_CLIENT_DO(3)
π GEARMAN_CLIENT_DO π
okay bestie, welcome to the Gearmand manual, section 3 π this one's all about GEARMAN_CLIENT_DO(3) and honestly? it's a whole vibe, let's get into it β¨
β¨ NAME β¨
gearman_client_do β Gearmand Documentation, <http://gearman.info/>
πΈ SYNOPSIS πΈ
#include <libgearman/gearman.h>
void *gearman_client_do(gearman_client_st <#c.gearman_client_st>
*client, const char *function_name, const char *unique, const void
*workload, size_t <#c.size_t> workload_size, size_t <#c.size_t>
*result_size, gearman_return_t <#c.gearman_return_t> *ret_ptr)
Changed in version 0.21: GEARMAN_PAUSE <#c.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 <#c.gearman_client_st>
*client, const char *function_name, const char *unique, const void
*workload, size_t <#c.size_t> workload_size, size_t <#c.size_t>
*result_size, gearman_return_t <#c.gearman_return_t> *ret_ptr)
void *gearman_client_do_low(gearman_client_st <#c.gearman_client_st>
*client, const char *function_name, const char *unique, const void
*workload, size_t <#c.size_t> workload_size, size_t <#c.size_t>
*result_size, gearman_return_t <#c.gearman_return_t> *ret_ptr)
π DESCRIPTION π
gearman_client_do() sends one single request over to the gearmand server and then justβ¦ waits for a reply. that's it, that's the whole job π«Ά
gearman_client_do_high() and gearman_client_do_low() are literally identical to gearman_client_do(), except they set the priority to either high or low. same girl, different energy level π
and the way that all of these functions block until either a response or an error comes back?? iconic behaviour honestly. no half-sends, no "maybe later" β you're getting a result or you're getting a problem β¨
π RETURN VALUE π
gearman_client_do() hands you back a pointer to a value, and heads up bestie β the caller has to release it. that's on you π
if you passed in ret_ptr, any errors that happened along the way get stashed in there instead.
β οΈ real talk: since aNULL/zero value is a perfectly valid value, you will always need to checkret_ptrif you actually care about knowing whether an error went down. the value alone will not tell you. periodt π
π¦ 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 π
want to go deeper? bestie, the info is right here: <http://gearman.info/>
See also:
π Author π
Data Differential <http://www.datadifferential.com/>
π Copyright π
2011-2014, Data Differential, <http://www.datadifferential.com/>
and that's the whole page, no cap π this was 1.1.21+ds, dated Feb 04, 2026, brought to you by the Gearmand crew β go forth and gearman_client_do responsibly, mwah π«Άβ¨π
π¦ where this page comes from
- ubuntu resolute: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- ubuntu stonking: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms