GEARMAN_CLIENT_DO_HIGH_BACKGROUND(3)
π gearman_client_do_high_background(3) π
okay bestie, sit down, hydrate, and let's talk about the third section of the manual: gearman_client_do_high_background β the gearmand girly who serves the docs at http://gearman.info/ β¨
π NAME π
gearman_client_do_high_background β it's the Gearmand Documentation, and the whole vibe lives at http://gearman.info/ π
πΈ SYNOPSIS πΈ
first things first, you gotta pull in the header, no cap:
#include <libgearman/gearman.h>
and there's this type hanging around:
type gearman_priority_t
then the plain background queen:
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)
lowkey a glow-up happened in version0.21:GEARMAN_PAUSEwill no longer be returned. A do operation now runs until it has been submitted. periodt. π¦
and here's our girl, the high-priority one, main character energy fr fr:
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)
and her low-priority sister, she's iconic too:
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 β¨
so gearman_client_do_background() does one single request to the gearmand server and hands you back the status through gearman_return_t π« one request, one status, that's the whole plot.
now, gearman_client_add_task_high_background() and gearman_client_add_task_low_background() are literally identical to gearman_client_do_background() β the only difference is they set the gearman_priority_t to either high or low. same girl, different energy level π₯
if job_handle is not NULL, it's gonna get populated with the name of the job_handle for the task that got created. and bestie, listen: the job handle needs to be the size of GEARMAN_JOB_HANDLE_SIZE. no skimping on the buffer, she needs her space. please see gearman_job_handle_t for more information π«Ά
π RETURN VALUE π
gearman_return_t β that's it, that's the return. that's what you're getting back.
π EXAMPLE π
here's the whole thing, copy it exactly, don't be weird about it:
/*
# 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: http://gearman.info/
See also:
π Author π
Data Differential http://www.datadifferential.com/
π Copyright π
2011-2014, Data Differential, http://www.datadifferential.com/
aaaand that's the whole page, bestie π it's running version 1.1.21+ds, dated Feb 04 β go forth, submit your background jobs, and slay π
β¨π¦
π¦ 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