1GEARMAN_CLIENT_DO_BACKGROUND(3) Gearmand GEARMAN_CLIENT_DO_BACKGROUND(3)
2
3
4
6 gearman_client_do_background - Gearmand Documentation, http://gear‐
7 man.info/
8
10 #include <libgearman/gearman.h>
11
12 gearman_priority_t
13
14 gearman_return_t gearman_client_do_background(gear‐
15 man_client_st *client, const char *function_name, const char *unique,
16 const void *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(gear‐
23 man_client_st *client, const char *function_name, const char *unique,
24 const void *workload, size_t workload_size, gearman_job_han‐
25 dle_t job_handle)
26
27 gearman_return_t gearman_client_do_low_background(gear‐
28 man_client_st *client, const char *function_name, const char *unique,
29 const void *workload, size_t workload_size, gearman_job_han‐
30 dle_t job_handle)
31
33 gearman_client_do_background() executes a single request to the gear‐
34 mand server and returns the status via gearman_return_t.
35
36 gearman_client_add_task_high_background() and gear‐
37 man_client_add_task_low_background() are identical to
38 gearman_client_do_background(), only they set the gearman_priority_t to
39 either high or low.
40
41 If job_handle is not NULL, it will be populated with the name of the
42 job_handle for the task created. The job handle needs to be the size of
43 GEARMAN_JOB_HANDLE_SIZE. Please see gearman_job_handle_t for more
44 information.
45
47 gearman_return_t
48
50 /*
51 # Gearman server and library
52 # Copyright (C) 2012 Data Differential, http://datadifferential.com/
53 # All rights reserved.
54 #
55 # Use and distribution licensed under the BSD license. See
56 # the COPYING file in this directory for full text.
57 */
58
59 #include <string.h>
60 #include <stdlib.h>
61 #include <stdio.h>
62 #include <libgearman-1.0/gearman.h>
63
64 int main(void)
65 {
66 gearman_client_st *client= gearman_client_create(NULL);
67
68 gearman_return_t ret= gearman_client_add_server(client, "localhost", 0);
69 if (gearman_failed(ret))
70 {
71 return EXIT_FAILURE;
72 }
73
74 gearman_job_handle_t job_handle;
75 gearman_return_t rc= gearman_client_do_background(client,
76 "reverse_function",
77 "unique_value",
78 "my string to reverse", strlen("my string to reverse"),
79 job_handle);
80
81 if (gearman_success(rc))
82 {
83 // Make use of value
84 printf("%s\n", job_handle);
85 }
86
87 gearman_client_free(client);
88
89 return 0;
90 }
91
92
94 To find out more information please check: http://gearman.info/
95
96 SEE ALSO:
97 gearmand(8) libgearman(3) gearman_strerror(3)
98
100 Data Differential http://www.datadifferential.com/
101
103 2011-2014, Data Differential, http://www.datadifferential.com/
104
105
106
107
1081.1.19.1 Feb 18, 2020 GEARMAN_CLIENT_DO_BACKGROUND(3)