diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-02-16 10:06:36 +0900 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-02-16 10:06:36 +0900 |
commit | a376c91494c954491fd424f3b51ab4579b9846a2 (patch) | |
tree | e306cef422138378720daa843703fc94331ad08e /src/ctx.hpp | |
parent | fb1209c72bbfd431b61fa4588785586d24ef67c9 (diff) |
XS_CTX_MAX_SOCKETS option implemented
To implement context options properly, initialisation of context
is postponed till creation of the first socket. In the meantime
it is possible to set socket options.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/ctx.hpp')
-rw-r--r-- | src/ctx.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ctx.hpp b/src/ctx.hpp index 8c3941f..56b5d4c 100644 --- a/src/ctx.hpp +++ b/src/ctx.hpp @@ -73,6 +73,9 @@ namespace xs // after the last one is closed. int terminate (); + // Set context option. + int setctxopt (int option_, const void *optval_, size_t optvallen_); + // Create and destroy a socket. xs::socket_base_t *create_socket (int type_); void destroy_socket (xs::socket_base_t *socket_); @@ -119,6 +122,10 @@ namespace xs typedef std::vector <uint32_t> emtpy_slots_t; emtpy_slots_t empty_slots; + // If true, xs_init has been called but no socket have been created + // yes. Launching of I/O threads is delayed. + bool starting; + // If true, xs_term was already called. bool terminating; @@ -160,6 +167,15 @@ namespace xs xs::socket_base_t *log_socket; mutex_t log_sync; + // Maximum number of sockets that can be opened at the same time. + int max_sockets; + + // Number of I/O threads to launch. + uint32_t io_thread_count; + + // Synchronisation of access to context options. + mutex_t opt_sync; + ctx_t (const ctx_t&); const ctx_t &operator = (const ctx_t&); }; |