gearman_client_st.rst 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ==========================
  2. Client (gearman_client_st)
  3. ==========================
  4. --------
  5. SYNOPSIS
  6. --------
  7. #include <libgearman/gearman.h>
  8. .. c:type:: gearman_client_st
  9. .. c:type:: gearman_task_context_free_fn
  10. .. c:function:: int gearman_client_timeout(gearman_client_st *client)
  11. .. c:function:: void gearman_client_set_timeout(gearman_client_st *client, int timeout)
  12. .. c:function:: void *gearman_client_context(const gearman_client_st *client)
  13. .. c:function:: void gearman_client_set_context(gearman_client_st *client, void *context)
  14. .. c:function:: void gearman_client_set_workload_malloc_fn(gearman_client_st *client, gearman_malloc_fn *function, void *context)
  15. .. deprecated:: 0.23
  16. Use :c:type:`gearman_allocator_t`
  17. .. c:function:: void gearman_client_set_workload_free_fn(gearman_client_st *client, gearman_free_fn *function, void *context)
  18. .. deprecated:: 0.23
  19. Use :c:type:`gearman_allocator_t`
  20. .. c:function:: void gearman_client_task_free_all(gearman_client_st *client)
  21. .. c:function:: void gearman_client_set_task_context_free_fn(gearman_client_st *client, gearman_task_context_free_fn *function)
  22. Link with -lgearman
  23. -----------
  24. DESCRIPTION
  25. -----------
  26. :c:type:`gearman_client_st` is used for :term:`client` communication with the server.
  27. :c:func:`gearman_client_context` and :c:func:`gearman_client_set_context` can be used to store an arbitrary object for the user.
  28. :c:func:`gearman_client_set_task_context_free_fn` sets a trigger that will be called when a :c:type:`gearman_task_st` is released.
  29. :c:func:`gearman_client_timeout` and :c:func:`gearman_client_set_timeout` get and set the current connection timeout value, in milliseconds, for the client.
  30. Normally :manpage:`malloc(3)` and :manpage:`free(3)` are used for allocation and releasing workloads. :c:func:`gearman_client_set_workload_malloc_fn` and :c:func:`gearman_client_set_workload_free_fn` can be used to replace these with custom functions. (These have been deprecated, please see :c:type:`gearman_allocator_t` for the updated interface.
  31. :c:func:`gearman_client_task_free_all` is used to free all current :c:type:`gearman_task_st` that have been created with the :c:type:`gearman_client_st`.
  32. .. warning::
  33. By calling :c:func:`gearman_client_task_free_all` you can end up with a SEGFAULT if you try to use any :c:type:`gearman_task_st` that you have kept pointers too.
  34. ------------
  35. RETURN VALUE
  36. ------------
  37. :c:func:`gearman_client_timeout` returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of -1 means an infinite timeout value.
  38. ----
  39. HOME
  40. ----
  41. To find out more information please check:
  42. `https://gearman.org/gearmand/ <https://gearman.org/gearmand/>`_
  43. .. seealso::
  44. :manpage:`gearmand(8)` :manpage:`libgearman(3)` :manpage:`gearman_client_create(3)`