GEARMAN_CLIENT_DO_HIGH(3)

πŸ’– GEARMAN_CLIENT_DO_HIGH(3) πŸ’–

okay so bestie, we're in section 3 of the Gearmand manual, and today's main character is gearman_client_do_high β€” plus its two ride-or-die siblings. Buckle up, it's giving "let's actually understand async job priorities" energy. πŸ¦‹


✨ NAME ✨

gearman_client_do_high β€” Gearmand Documentation, http://gearman.info/


✨ SYNOPSIS ✨

First up, the header you gotta pull in, no cap:

#include <libgearman/gearman.h>

Then the trio. Here's the plain one, gearman_client_do:

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)

And here's the glow-up, gearman_client_do_high:

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)

And the chill one, gearman_client_do_low:

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)
🚨 Changed in version 0.21: GEARMAN_PAUSE will no longer be returned. A do operation will now run till completion or error. So like… no more pausing mid-vibe. It's all or nothing now, periodt.

🌸 DESCRIPTION 🌸

Okay so gearman_client_do() does one single request to the gearmand server, then just… sits there and waits for the reply. Very demure, very "I sent the text and now I'm refreshing the chat" energy. πŸ’…

gearman_client_do_high() and gearman_client_do_low() are literally identical to gearman_client_do() β€” no extra drama, no bonus options β€” the only difference is they set the priority to either high or low. That's it. That's the whole flex.

And all of these functions will block until either a response comes back or an error shows up. So your thread is not going anywhere until gearmand answers. πŸ™ˆ


⭐ RETURN VALUE ⭐

gearman_client_do() returns a pointer to a value that the caller must release. Yes bestie, that means you free it. It's your problem now. 🫢

If ret_ptr is provided, any errors that have occurred will be stored in it.

πŸ’€ Important, fr fr: since a NULL/zero value is a valid value, you will always need to check ret_ptr if you are concerned with errors. Like β€” a NULL result does not automatically mean something went wrong. Check the return code, always. ikyky.

πŸŽ€ EXAMPLE πŸŽ€

Here's a whole lil program doing the thing:

/*
# 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: http://gearman.info/

See also:


πŸ‘‘ Author

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

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


okay that's the whole page bestie, you ate it, go forth and prioritize your workloads πŸ’–βœ¨

This one came from 1.1.21+ds, dated Feb 04, 2026 β€” and yes, that's the same GEARMAN_CLIENT_DO_HIGH(3) energy you started with. slay 🌈

πŸ“¦ where this page comes from