![]() |
libzmq
master
ZeroMQ C++ Core Engine (LIBZMQ)
|
#include <ctx.hpp>
Classes | |
struct | pending_connection_t |
Public Types | |
enum | { term_tid = 0, reaper_tid = 1 } |
Public Member Functions | |
ctx_t () | |
~ctx_t () | |
bool | check_tag () |
zmq::io_thread_t * | choose_io_thread (uint64_t affinity_) |
void | connect_pending (const char *addr_, zmq::socket_base_t *bind_socket_) |
zmq::socket_base_t * | create_socket (int type_) |
void | destroy_socket (zmq::socket_base_t *socket_) |
endpoint_t | find_endpoint (const char *addr_) |
int | get (int option_) |
zmq::object_t * | get_reaper () |
void | pend_connection (const std::string &addr_, const endpoint_t &endpoint_, pipe_t **pipes_) |
int | register_endpoint (const char *addr_, const endpoint_t &endpoint_) |
void | send_command (uint32_t tid_, const command_t &command_) |
int | set (int option_, int optval_) |
int | shutdown () |
void | start_thread (thread_t &thread_, thread_fn *tfn_, void *arg_) const |
int | terminate () |
int | unregister_endpoint (const std::string &addr_, socket_base_t *socket_) |
void | unregister_endpoints (zmq::socket_base_t *socket_) |
Private Types | |
typedef std::vector< uint32_t > | empty_slots_t |
typedef std::map< std::string, endpoint_t > | endpoints_t |
typedef std::vector< zmq::io_thread_t * > | io_threads_t |
typedef std::multimap< std::string, pending_connection_t > | pending_connections_t |
enum | side { connect_side, bind_side } |
typedef array_t< socket_base_t > | sockets_t |
Private Member Functions | |
ctx_t (const ctx_t &) | |
void | connect_inproc_sockets (zmq::socket_base_t *bind_socket_, options_t &bind_options, const pending_connection_t &pending_connection_, side side_) |
const ctx_t & | operator= (const ctx_t &) |
Static Private Attributes | |
static atomic_counter_t | max_socket_id |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
zmq::ctx_t::ctx_t | ( | ) |
Definition at line 74 of file ctx.cpp.
References crypto_sync, zmq::mutex_t::lock(), zmq::mutex_t::unlock(), and zmq_assert.
zmq::ctx_t::~ctx_t | ( | ) |
Definition at line 114 of file ctx.cpp.
References zmq::array_t< T, ID >::empty(), io_threads, LIBZMQ_DELETE, reaper, slots, sockets, tag, zmq_assert, and ZMQ_CTX_TAG_VALUE_BAD.
|
private |
bool zmq::ctx_t::check_tag | ( | ) |
Definition at line 109 of file ctx.cpp.
References tag, and ZMQ_CTX_TAG_VALUE_GOOD.
zmq::io_thread_t * zmq::ctx_t::choose_io_thread | ( | uint64_t | affinity_ | ) |
Definition at line 433 of file ctx.cpp.
References io_threads.
Referenced by zmq::object_t::choose_io_thread().
|
private |
Definition at line 565 of file ctx.cpp.
References zmq::command_t::args, zmq::command_t::bind, zmq::command_t::args_t::bind, zmq::ctx_t::pending_connection_t::bind_pipe, bind_side, zmq::msg_t::close(), zmq::options_t::conflate, zmq::ctx_t::pending_connection_t::connect_pipe, zmq::ctx_t::pending_connection_t::endpoint, errno_assert, zmq::pipe_t::flush(), zmq::object_t::get_tid(), zmq::options_t::identity, zmq::msg_t::identity, zmq::options_t::identity_size, zmq::own_t::inc_seqnum(), zmq::msg_t::init_size(), max_socket_id, zmq::endpoint_t::options, zmq::command_t::args_t::pipe, zmq::object_t::process_command(), zmq::options_t::rcvhwm, zmq::pipe_t::read(), zmq::options_t::recv_identity, zmq::object_t::send_bind(), zmq::object_t::send_inproc_connected(), zmq::pipe_t::set_hwms(), zmq::pipe_t::set_hwms_boost(), zmq::object_t::set_tid(), zmq::options_t::sndhwm, zmq::endpoint_t::socket, zmq::command_t::type, zmq::options_t::type, zmq::pipe_t::write(), zmq_assert, ZMQ_DEALER, ZMQ_PUB, ZMQ_PULL, ZMQ_PUSH, and ZMQ_SUB.
Referenced by connect_pending(), and pend_connection().
void zmq::ctx_t::connect_pending | ( | const char * | addr_, |
zmq::socket_base_t * | bind_socket_ | ||
) |
Definition at line 552 of file ctx.cpp.
References bind_side, connect_inproc_sockets(), endpoints, endpoints_sync, zmq::mutex_t::lock(), pending_connections, and zmq::mutex_t::unlock().
Referenced by zmq::object_t::connect_pending().
zmq::socket_base_t * zmq::ctx_t::create_socket | ( | int | type_ | ) |
Definition at line 320 of file ctx.cpp.
References zmq::atomic_counter_t::add(), alloc_assert, zmq::socket_base_t::create(), empty_slots, ETERM, zmq::reaper_t::get_mailbox(), zmq::io_thread_t::get_mailbox(), zmq::socket_base_t::get_mailbox(), io_thread_count, io_threads, zmq::mutex_t::lock(), max_socket_id, max_sockets, opt_sync, zmq::array_t< T, ID >::push_back(), reaper, reaper_tid, slot_count, slot_sync, slots, sockets, zmq::reaper_t::start(), zmq::io_thread_t::start(), starting, term_mailbox, term_tid, terminating, unlikely, and zmq::mutex_t::unlock().
Referenced by terminate(), and zmq_socket().
void zmq::ctx_t::destroy_socket | ( | zmq::socket_base_t * | socket_ | ) |
Definition at line 397 of file ctx.cpp.
References zmq::array_t< T, ID >::empty(), empty_slots, zmq::array_t< T, ID >::erase(), zmq::object_t::get_tid(), zmq::mutex_t::lock(), reaper, slot_sync, slots, sockets, zmq::reaper_t::stop(), terminating, and zmq::mutex_t::unlock().
Referenced by zmq::object_t::destroy_socket().
zmq::endpoint_t zmq::ctx_t::find_endpoint | ( | const char * | addr_ | ) |
Definition at line 508 of file ctx.cpp.
References ECONNREFUSED, endpoints, endpoints_sync, zmq::own_t::inc_seqnum(), zmq::mutex_t::lock(), zmq::endpoint_t::socket, and zmq::mutex_t::unlock().
Referenced by zmq::object_t::find_endpoint().
Definition at line 293 of file ctx.cpp.
References blocky, clipped_maxsocket(), io_thread_count, ipv6, max_msgsz, max_sockets, ZMQ_BLOCKY, ZMQ_IO_THREADS, ZMQ_IPV6, ZMQ_MAX_MSGSZ, ZMQ_MAX_SOCKETS, and ZMQ_SOCKET_LIMIT.
Referenced by zmq::socket_base_t::socket_base_t().
zmq::object_t * zmq::ctx_t::get_reaper | ( | ) |
Definition at line 417 of file ctx.cpp.
References reaper.
Referenced by zmq::object_t::send_reap(), and zmq::object_t::send_reaped().
void zmq::ctx_t::pend_connection | ( | const std::string & | addr_, |
const endpoint_t & | endpoint_, | ||
pipe_t ** | pipes_ | ||
) |
Definition at line 531 of file ctx.cpp.
References connect_inproc_sockets(), connect_side, endpoints, endpoints_sync, zmq::own_t::inc_seqnum(), zmq::mutex_t::lock(), pending_connections, zmq::endpoint_t::socket, and zmq::mutex_t::unlock().
Referenced by zmq::object_t::pend_connection().
int zmq::ctx_t::register_endpoint | ( | const char * | addr_, |
const endpoint_t & | endpoint_ | ||
) |
Definition at line 453 of file ctx.cpp.
References EADDRINUSE, endpoints, endpoints_sync, zmq::mutex_t::lock(), and zmq::mutex_t::unlock().
Referenced by zmq::object_t::register_endpoint().
void zmq::ctx_t::send_command | ( | uint32_t | tid_, |
const command_t & | command_ | ||
) |
Definition at line 428 of file ctx.cpp.
References zmq::i_mailbox::send(), and slots.
Referenced by zmq::object_t::send_command(), zmq::object_t::send_done(), and zmq::object_t::send_stop().
Definition at line 241 of file ctx.cpp.
References blocky, clipped_maxsocket(), io_thread_count, ipv6, zmq::mutex_t::lock(), max_msgsz, max_sockets, opt_sync, thread_priority, thread_sched_policy, zmq::mutex_t::unlock(), ZMQ_BLOCKY, ZMQ_IO_THREADS, ZMQ_IPV6, ZMQ_MAX_MSGSZ, ZMQ_MAX_SOCKETS, ZMQ_THREAD_PRIORITY, and ZMQ_THREAD_SCHED_POLICY.
int zmq::ctx_t::shutdown | ( | ) |
Definition at line 222 of file ctx.cpp.
References zmq::array_t< T, ID >::empty(), zmq::mutex_t::lock(), reaper, zmq::array_t< T, ID >::size(), slot_sync, sockets, starting, zmq::reaper_t::stop(), stop, terminating, and zmq::mutex_t::unlock().
Definition at line 422 of file ctx.cpp.
References zmq::thread_t::setSchedulingParameters(), zmq::thread_t::start(), thread_priority, and thread_sched_policy.
int zmq::ctx_t::terminate | ( | ) |
Definition at line 148 of file ctx.cpp.
References zmq::socket_base_t::bind(), zmq::socket_base_t::close(), create_socket(), zmq::command_t::done, zmq::array_t< T, ID >::empty(), errno_assert, zmq::mutex_t::lock(), pending_connections, reaper, zmq::mailbox_t::recv(), zmq::array_t< T, ID >::size(), slot_sync, sockets, starting, zmq::reaper_t::stop(), stop, term_mailbox, terminating, zmq::command_t::type, zmq::mutex_t::unlock(), zmq_assert, and ZMQ_PAIR.
int zmq::ctx_t::unregister_endpoint | ( | const std::string & | addr_, |
socket_base_t * | socket_ | ||
) |
Definition at line 470 of file ctx.cpp.
References endpoints, endpoints_sync, zmq::mutex_t::lock(), and zmq::mutex_t::unlock().
Referenced by zmq::object_t::unregister_endpoint().
void zmq::ctx_t::unregister_endpoints | ( | zmq::socket_base_t * | socket_ | ) |
Definition at line 490 of file ctx.cpp.
References endpoints, endpoints_sync, zmq::mutex_t::lock(), and zmq::mutex_t::unlock().
Referenced by zmq::object_t::unregister_endpoints().
|
private |
|
private |
|
private |
Definition at line 156 of file ctx.hpp.
Referenced by create_socket(), and destroy_socket().
|
private |
Definition at line 187 of file ctx.hpp.
Referenced by connect_pending(), find_endpoint(), pend_connection(), register_endpoint(), unregister_endpoint(), and unregister_endpoints().
|
private |
Definition at line 194 of file ctx.hpp.
Referenced by connect_pending(), find_endpoint(), pend_connection(), register_endpoint(), unregister_endpoint(), and unregister_endpoints().
|
private |
Definition at line 206 of file ctx.hpp.
Referenced by create_socket(), get(), and set().
|
private |
Definition at line 176 of file ctx.hpp.
Referenced by choose_io_thread(), create_socket(), and ~ctx_t().
|
private |
|
private |
|
staticprivate |
Definition at line 197 of file ctx.hpp.
Referenced by connect_inproc_sockets(), and create_socket().
|
private |
Definition at line 200 of file ctx.hpp.
Referenced by create_socket(), get(), and set().
|
private |
Definition at line 219 of file ctx.hpp.
Referenced by create_socket(), and set().
|
private |
Definition at line 191 of file ctx.hpp.
Referenced by connect_pending(), pend_connection(), and terminate().
|
private |
Definition at line 172 of file ctx.hpp.
Referenced by create_socket(), destroy_socket(), get_reaper(), shutdown(), terminate(), and ~ctx_t().
|
private |
Definition at line 179 of file ctx.hpp.
Referenced by create_socket().
|
private |
Definition at line 169 of file ctx.hpp.
Referenced by create_socket(), destroy_socket(), shutdown(), and terminate().
|
private |
Definition at line 180 of file ctx.hpp.
Referenced by create_socket(), destroy_socket(), send_command(), and ~ctx_t().
|
private |
Definition at line 152 of file ctx.hpp.
Referenced by create_socket(), destroy_socket(), shutdown(), terminate(), and ~ctx_t().
|
private |
Definition at line 160 of file ctx.hpp.
Referenced by create_socket(), shutdown(), and terminate().
|
private |
Definition at line 146 of file ctx.hpp.
Referenced by check_tag(), and ~ctx_t().
|
private |
Definition at line 183 of file ctx.hpp.
Referenced by create_socket(), and terminate().
|
private |
Definition at line 163 of file ctx.hpp.
Referenced by create_socket(), destroy_socket(), shutdown(), and terminate().
|
private |
Definition at line 215 of file ctx.hpp.
Referenced by set(), and start_thread().
|
private |
Definition at line 216 of file ctx.hpp.
Referenced by set(), and start_thread().