1GEARMAN_CLIENT_DO(3) Gearmand GEARMAN_CLIENT_DO(3)
2
3
4
6 gearman_client_do - Gearmand Documentation, http://gearman.info/
7
9 #include <libgearman/gearman.h>
10
11 void *gearman_client_do(gearman_client_st *client, const char *func‐
12 tion_name, const char *unique, const void *workload, size_t work‐
13 load_size, size_t *result_size, gearman_return_t *ret_ptr)
14
15 Changed in version 0.21: GEARMAN_PAUSE will no longer be returned. A do
16 operation will now run till completion or error.
17
18
19 void *gearman_client_do_high(gearman_client_st *client, const
20 char *function_name, const char *unique, const void *workload,
21 size_t workload_size, size_t *result_size, gearman_return_t *ret_ptr)
22
23 void *gearman_client_do_low(gearman_client_st *client, const
24 char *function_name, const char *unique, const void *workload,
25 size_t workload_size, size_t *result_size, gearman_return_t *ret_ptr)
26
28 gearman_client_do() executes a single request to the gearmand server
29 and waits for a reply.
30
31 gearman_client_do_high() and gearman_client_do_low() are identical to
32 gearman_client_do(), only they set the priority to either high or low.
33
34 All of the functions will block until either a response or an error is
35 returned.
36
38 gearman_client_do() returns a pointer to a value that the caller must
39 release. If ret_ptr is provided any errors that have occurred will be
40 stored in it. Since a NULL/zero value is a valid value, you will always
41 need to check ret_ptr if you are concerned with errors.
42
44 /*
45 # Gearman server and library
46 # Copyright (C) 2012 Data Differential, http://datadifferential.com/
47 # All rights reserved.
48 #
49 # Use and distribution licensed under the BSD license. See
50 # the COPYING file in this directory for full text.
51 */
52
53 #include <string.h>
54 #include <stdlib.h>
55 #include <libgearman/gearman.h>
56
57 int main(void)
58 {
59 gearman_client_st *client= gearman_client_create(NULL);
60
61 gearman_return_t ret= gearman_client_add_server(client, "localhost", 0);
62 if (gearman_failed(ret))
63 {
64 return EXIT_FAILURE;
65 }
66
67 size_t result_size;
68 gearman_return_t rc;
69 void *value= gearman_client_do(client, "reverse_function", "unique_value",
70 "my string to reverse", strlen("my string to reverse"),
71 &result_size, &rc);
72
73 if (gearman_success(rc))
74 {
75 // Make use of value
76 }
77 free(value);
78
79 gearman_client_free(client);
80
81 return 0;
82 }
83
84
86 To find out more information please check: http://gearman.info/
87
88 SEE ALSO:
89 gearmand(8) libgearman(3) gearman_strerror(3)
90
92 Data Differential http://www.datadifferential.com/
93
95 2011-2014, Data Differential, http://www.datadifferential.com/
96
97
98
99
1001.1.18 December 11, 2017 GEARMAN_CLIENT_DO(3)