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 a NULL/zero value is a perfectly valid value, you will always need to check ret_ptr if 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/>


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