Commit 81b9f21b authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #1132 from rodgert/master

Added test and doc section for ZMQ_SHARED message flag
parents d4d65da2 82282d69
......@@ -29,6 +29,10 @@ allows application to retrieve the remote endpoint via 'getpeername(2)'. Be
aware that the respective socket might be closed already, reused even.
Currently only implemented for TCP sockets.
*ZMQ_SHARED*::
Indicates that a message has been copied and MAY share underlying storage
with another copy of this message.
RETURN VALUE
------------
The _zmq_msg_get()_ function shall return the value for the property if
......
......@@ -65,6 +65,26 @@ int main (void)
more = zmq_msg_more (&msg);
assert (more == 0);
// Test ZMQ_SHARED property
zmq_msg_t msg_a;
rc = zmq_msg_init_size(&msg_a, 1024); // large enough to be a type_lmsg
assert (rc == 0);
// Message is not shared
rc = zmq_msg_get(&msg_a, ZMQ_SHARED);
assert (rc == 0);
zmq_msg_t msg_b;
rc = zmq_msg_init(&msg_b);
assert (rc == 0);
rc = zmq_msg_copy(&msg_b, &msg_a);
assert (rc == 0);
// Message is now shared
rc = zmq_msg_get(&msg_b, ZMQ_SHARED);
assert (rc == 1);
// Deallocate the infrastructure.
rc = zmq_close (sc);
assert (rc == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment