Set and arrange propagation of thread safe sockets flag.

We use a distinct context initialisation function to specify
all sockets derived therefrom will be thread safe.

However the inheritance is done exclusively in the C interface.
This is not really correct, but it is chosen to minimise
interference with the existing C++ code, including any
construct or other calls within the C++ code base.
Semantically the C++ code should be unchanged,
physically some data structures and extra methods are
provided by they're only used from the C binding.
This commit is contained in:
skaller
2012-02-04 02:17:35 +11:00
parent 988efbc73a
commit 520ad3c2d7
6 changed files with 41 additions and 3 deletions

View File

@@ -99,6 +99,10 @@ namespace zmq
reaper_tid = 1
};
// create thread safe sockets
void set_thread_safe();
bool get_thread_safe() const;
~ctx_t ();
private:
@@ -151,6 +155,8 @@ namespace zmq
zmq::socket_base_t *log_socket;
mutex_t log_sync;
bool thread_safe_flag;
ctx_t (const ctx_t&);
const ctx_t &operator = (const ctx_t&);
};