gearman_client_add_task_background.rst 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. =========================
  2. Creating background tasks
  3. =========================
  4. --------
  5. SYNOPSIS
  6. --------
  7. #include <libgearman/gearman.h>
  8. .. c:function:: gearman_task_st *gearman_client_add_task_background(gearman_client_st *client,
  9. gearman_task_st *task,
  10. void *context,
  11. const char *function_name,
  12. const char *unique,
  13. const void *workload,
  14. size_t workload_size,
  15. gearman_return_t *ret_ptr)
  16. Link with -lgearman
  17. -----------
  18. DESCRIPTION
  19. -----------
  20. :c:func:`gearman_client_add_task_background` creates a background task and adds it ito the given :c:type:`gearman_client_st`. Execution of the task does now begin until :c:func:`gearman_client_run_tasks` is called.
  21. If the unique value is not set, then a unique will be assigned.
  22. :c:func:`gearman_client_add_task_background_high` and :c:func:`gearman_client_add_task_background_low` are
  23. identical to :c:func:`gearman_client_do`, only they set the priority to
  24. either high or low.
  25. .. warning::
  26. You may wish to avoid using :c:func:`gearman_client_add_task_background` with a stack based allocated
  27. :c:type:`gearman_task_st`. The most common issues related to ABI safety involve stack allocated structures. If you use a stack based
  28. :c:type:`gearman_task_st` you must free it with :c:func:`gearman_task_free`.
  29. ------------
  30. RETURN VALUE
  31. ------------
  32. The :c:type:`gearman_task_st` is created and a pointer to it is returned. On error NULL is returned and ret_ptr is set with a :c:type:`gearman_return_t`.
  33. ----
  34. HOME
  35. ----
  36. To find out more information please check:
  37. `http://gearman.info/ <http://gearman.info/>`_
  38. .. seealso::
  39. :manpage:`gearmand(8)` :manpage:`libgearman(3)` :manpage:`gearman_task_st`