~mordred/gearmand/cancel-job

« back to all changes in this revision

Viewing changes to docs/libgearman/gearman_worker_create.rst

  • Committer: Brian Aker
  • Date: 2012-05-04 03:46:04 UTC
  • Revision ID: brian@tangent.org-20120504034604-5t22ae4v2o45zjkq
Update for libtest, documentation, and fix for root bzr dir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
#include <libgearman/gearman.h>
10
10
 
11
 
.. c:function:: gearman_worker_st *gearman_worker_create(gearman_worker_st *client);
12
 
 
13
 
.. c:function:: gearman_worker_st *gearman_worker_clone(gearman_worker_st *client, const gearman_worker_st *from);
14
 
 
15
 
.. c:function:: void gearman_worker_free(gearman_worker_st *client);
 
11
.. c:function:: gearman_worker_st *gearman_worker_create(gearman_worker_st *client)
 
12
 
 
13
.. c:function:: gearman_worker_st *gearman_worker_clone(gearman_worker_st *client, const gearman_worker_st *from)
 
14
 
 
15
.. c:function:: void gearman_worker_free(gearman_worker_st *client)
16
16
 
17
17
Link with -lgearman
18
18
 
23
23
 
24
24
gearman_worker_create() is used to create a :c:type:`gearman_worker_st`  structure that will then
25
25
be used by other libgearman(3) client functions to communicate with the server. You
26
 
should either pass a statically declared :c:type:`gearman_worker_st`  to gearman_worker_create() or
 
26
should either pass a statically declared :c:type:`gearman_worker_st`  to gearman_worker_create) or
27
27
a NULL. If a NULL passed in then a structure is allocated for you.
28
28
 
29
 
:c:func:`gearman_worker_clone()` is similar to :c:func:`gearman_worker_create()` but it copies the
 
29
:c:func:`gearman_worker_clone` is similar to :c:func:`gearman_worker_create` but it copies the
30
30
defaults and list of servers from the source :c:type:`gearman_worker_st`. If you pass a null as
31
31
the argument for the source to clone, it is the same as a call to gearman_worker_create().
32
32
If the destination argument is NULL a :c:type:`gearman_worker_st`  will be allocated for you.
33
33
 
34
34
To clean up memory associated with a :c:type:`gearman_worker_st`  structure you should pass
35
 
it to :c:func:`gearman_worker_free()` when you are finished using it. :c:type:`gearman_worker_free()` is
 
35
it to :c:func:`gearman_worker_free` when you are finished using it. :c:type:`gearman_worker_free` is
36
36
the only way to make sure all memory is deallocated when you finish using
37
37
the structure.
38
38
 
39
 
You may wish to avoid using :c:func:`gearman_worker_create()` or :c:func:`gearman_worker_clone()` with a
 
39
You may wish to avoid using :c:func:`gearman_worker_create` or :c:func:`gearman_worker_clone` with a
40
40
stack based allocation, ie the first parameter. The most common issues related to ABI safety involve
41
41
heap allocated structures.
42
42
 
46
46
------------
47
47
 
48
48
 
49
 
:c:func:`gearman_worker_create()` returns a pointer to the :c:type:`gearman_worker_st` that was created
 
49
:c:func:`gearman_worker_create` returns a pointer to the :c:type:`gearman_worker_st` that was created
50
50
(or initialized). On an allocation failure, it returns NULL.
51
51
 
52
 
:c:func:`gearman_worker_clone()` returns a pointer to the :c:type:`gearman_worker_st` that was created
 
52
:c:func:`gearman_worker_clone` returns a pointer to the :c:type:`gearman_worker_st` that was created
53
53
(or initialized). On an allocation failure, it returns NULL.
54
54
 
55
55