1GEARMAN_CLIENT_DO_BACKGROUND(3)    Gearmand    GEARMAN_CLIENT_DO_BACKGROUND(3)
2
3
4

NAME

6       gearman_client_do_background  -  Gearmand  Documentation,  http://gear
7       man.info/
8

SYNOPSIS

10       #include <libgearman/gearman.h>
11
12       type gearman_priority_t
13
14       gearman_return_t         gearman_client_do_background(gearman_client_st
15       *client,  const  char  *function_name,  const  char *unique, const void
16       *workload, size_t workload_size, char *job_handle)
17
18       Changed in version 0.21: GEARMAN_PAUSE will no longer be returned. A do
19       operation will now run until it has been submitted.
20
21
22       gearman_return_t    gearman_client_do_high_background(gearman_client_st
23       *client, const char *function_name,  const  char  *unique,  const  void
24       *workload, size_t workload_size, gearman_job_handle_t job_handle)
25
26       gearman_return_t     gearman_client_do_low_background(gearman_client_st
27       *client, const char *function_name,  const  char  *unique,  const  void
28       *workload, size_t workload_size, gearman_job_handle_t job_handle)
29

DESCRIPTION

31       gearman_client_do_background()  executes  a single request to the gear‐
32       mand server and returns the status via gearman_return_t.
33
34       gearman_client_add_task_high_background()           and           gear‐
35       man_client_add_task_low_background()       are       identical       to
36       gearman_client_do_background(), only they set the gearman_priority_t to
37       either high or low.
38
39       If  job_handle  is  not NULL, it will be populated with the name of the
40       job_handle for the task created. The job handle needs to be the size of
41       GEARMAN_JOB_HANDLE_SIZE.  Please  see gearman_job_handle_t for more in‐
42       formation.
43

RETURN VALUE

45       gearman_return_t
46

EXAMPLE

48          /*
49          # Gearman server and library
50          # Copyright (C) 2012 Data Differential, http://datadifferential.com/
51          # All rights reserved.
52          #
53          # Use and distribution licensed under the BSD license.  See
54          # the COPYING file in this directory for full text.
55          */
56
57          #include <string.h>
58          #include <stdlib.h>
59          #include <stdio.h>
60          #include <libgearman-1.0/gearman.h>
61
62          int main(void)
63          {
64            gearman_client_st *client= gearman_client_create(NULL);
65
66            gearman_return_t ret= gearman_client_add_server(client, "localhost", 0);
67            if (gearman_failed(ret))
68            {
69              return EXIT_FAILURE;
70            }
71
72            gearman_job_handle_t job_handle;
73            gearman_return_t rc= gearman_client_do_background(client,
74                                                              "reverse_function",
75                                                              "unique_value",
76                                                              "my string to reverse", strlen("my string to reverse"),
77                                                              job_handle);
78
79            if (gearman_success(rc))
80            {
81              // Make use of value
82              printf("%s\n", job_handle);
83            }
84
85            gearman_client_free(client);
86
87            return 0;
88          }
89
90

HOME

92       To find out more information please check: http://gearman.info/
93
94       SEE ALSO:
95          gearmand(8) libgearman(3) gearman_strerror(3)
96

AUTHOR

98       Data Differential http://www.datadifferential.com/
99
101       2011-2014, Data Differential, http://www.datadifferential.com/
102
103
104
105
1061.1.20                           Nov 19, 2022  GEARMAN_CLIENT_DO_BACKGROUND(3)
Impressum