zmq_ctx_get.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. zmq_ctx_get(3)
  2. ==============
  3. NAME
  4. ----
  5. zmq_ctx_get - get context options
  6. SYNOPSIS
  7. --------
  8. *int zmq_ctx_get (void '*context', int 'option_name');*
  9. DESCRIPTION
  10. -----------
  11. The _zmq_ctx_get()_ function shall return the option specified by the
  12. 'option_name' argument.
  13. The _zmq_ctx_get()_ function accepts the following option names:
  14. ZMQ_IO_THREADS: Get number of I/O threads
  15. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  16. The 'ZMQ_IO_THREADS' argument returns the size of the 0MQ thread pool
  17. for this context.
  18. ZMQ_MAX_SOCKETS: Get maximum number of sockets
  19. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. The 'ZMQ_MAX_SOCKETS' argument returns the maximum number of sockets
  21. allowed for this context.
  22. ZMQ_MAX_MSGSZ: Get maximum message size
  23. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. The 'ZMQ_MAX_MSGSZ' argument returns the maximum size of a message
  25. allowed for this context. Default value is INT_MAX.
  26. ZMQ_ZERO_COPY_RECV: Get message decoding strategy
  27. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  28. The 'ZMQ_ZERO_COPY_RECV' argument return whether message decoder uses a zero copy
  29. strategy when receiving messages. Default value is 1.
  30. NOTE: in DRAFT state, not yet available in stable releases.
  31. ZMQ_SOCKET_LIMIT: Get largest configurable number of sockets
  32. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  33. The 'ZMQ_SOCKET_LIMIT' argument returns the largest number of sockets that
  34. linkzmq:zmq_ctx_set[3] will accept.
  35. ZMQ_IPV6: Set IPv6 option
  36. ~~~~~~~~~~~~~~~~~~~~~~~~~
  37. The 'ZMQ_IPV6' argument returns the IPv6 option for the context.
  38. ZMQ_BLOCKY: Get blocky setting
  39. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  40. The 'ZMQ_BLOCKY' argument returns 1 if the context will block on terminate,
  41. zero if the "block forever on context termination" gambit was disabled by
  42. setting ZMQ_BLOCKY to false on all new contexts.
  43. ZMQ_THREAD_SCHED_POLICY: Get scheduling policy for I/O threads
  44. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45. The 'ZMQ_THREAD_SCHED_POLICY' argument returns the scheduling policy for
  46. internal context's thread pool.
  47. ZMQ_THREAD_NAME_PREFIX: Get name prefix for I/O threads
  48. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. The 'ZMQ_THREAD_NAME_PREFIX' argument gets the numeric prefix of each thread
  50. created for the internal context's thread pool.
  51. ZMQ_MSG_T_SIZE: Get the zmq_msg_t size at runtime
  52. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  53. The 'ZMQ_MSG_T_SIZE' argument returns the size of the zmq_msg_t structure at
  54. runtime, as defined in the include/zmq.h public header.
  55. This is useful for example for FFI bindings that can't simply do a sizeof().
  56. RETURN VALUE
  57. ------------
  58. The _zmq_ctx_get()_ function returns a value of 0 or greater if successful.
  59. Otherwise it returns `-1` and sets 'errno' to one of the values defined
  60. below.
  61. ERRORS
  62. ------
  63. *EINVAL*::
  64. The requested option _option_name_ is unknown.
  65. EXAMPLE
  66. -------
  67. .Setting a limit on the number of sockets
  68. ----
  69. void *context = zmq_ctx_new ();
  70. zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256);
  71. int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS);
  72. assert (max_sockets == 256);
  73. ----
  74. .Switching off the context deadlock gambit
  75. ----
  76. zmq_ctx_set (ctx, ZMQ_BLOCKY, false);
  77. ----
  78. SEE ALSO
  79. --------
  80. linkzmq:zmq_ctx_set[3]
  81. linkzmq:zmq[7]
  82. AUTHORS
  83. -------
  84. This page was written by the 0MQ community. To make a change please
  85. read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.