diff options
author | Martin Lucina <mato@kotelna.sk> | 2010-03-09 18:47:31 +0100 |
---|---|---|
committer | Martin Lucina <mato@kotelna.sk> | 2010-03-09 18:47:31 +0100 |
commit | 1aee86408d575d6572b071d7564da7f006d1757e (patch) | |
tree | 98d54989b5961db8c458017034bfb8f981e98c8f /doc/zmq_msg_init_size.txt | |
parent | d790940fd06060c8a2c624b0e41e470ad31ae0d8 (diff) |
Documentation rewrite
Diffstat (limited to 'doc/zmq_msg_init_size.txt')
-rw-r--r-- | doc/zmq_msg_init_size.txt | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/doc/zmq_msg_init_size.txt b/doc/zmq_msg_init_size.txt index 9f09ade..1217eb2 100644 --- a/doc/zmq_msg_init_size.txt +++ b/doc/zmq_msg_init_size.txt @@ -4,58 +4,51 @@ zmq_msg_init_size(3) NAME ---- -zmq_msg_init_size - initialises 0MQ message of a specified size +zmq_msg_init_size - initialise 0MQ message of a specified size SYNOPSIS -------- -'int zmq_msg_init_size (zmq_msg_t *msg, size_t size);' +*int zmq_msg_init_size (zmq_msg_t '*msg', size_t 'size');* DESCRIPTION ----------- -Initialises 0MQ message 'size' bytes long. The implementation chooses whether -it is more efficient to store message content on the stack (small messages) or -on the heap (large messages). Therefore, never access message data directly -via 'zmq_msg_t' members, rather use 'zmq_msg_data' and 'zmq_msg_size' functions -to get message data and size. Note that the message data are not nullified to -avoid the associated performance impact. Thus you should expect your message to -contain bogus data after this call. +The _zmq_msg_init_size()_ function shall allocate any resources required to +store a message 'size' bytes long and initialise the message object referenced +by 'msg' to represent the newly allocated message. + +The implementation shall choose whether to store message content on the stack +(small messages) or on the heap (large messages). For performance reasons +_zmq_msg_init_size()_ shall not clear the message data. + +CAUTION: Never access 'zmq_msg_t' members directly, instead always use the +_zmq_msg_ family of functions. RETURN VALUE ------------ -In case of success the function returns zero. Otherwise it returns -1 and -sets 'errno' to the appropriate value. +The _zmq_msg_init_size()_ function shall return zero if successful. Otherwise +it shall return -1 and set 'errno' to one of the values defined below. ERRORS ------ *ENOMEM*:: -memory to hold the message cannot be allocated. - - -EXAMPLE -------- ----- -zmq_msg_t msg; -rc = zmq_msg_init_size (&msg, 6); -assert (rc == 0); -memcpy (zmq_msg_data (&msg), "ABCDEF", 6); -rc = zmq_send (s, &msg, 0); -assert (rc == 0); ----- +Insufficient storage space is available. SEE ALSO -------- -linkzmq:zmq_msg_close[3] -linkzmq:zmq_msg_init[3] linkzmq:zmq_msg_init_data[3] +linkzmq:zmq_msg_init[3] +linkzmq:zmq_msg_close[3] linkzmq:zmq_msg_data[3] linkzmq:zmq_msg_size[3] +linkzmq:zmq[7] -AUTHOR ------- -Martin Sustrik <sustrik at 250bpm dot com> +AUTHORS +------- +The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and +Martin Lucina <mato@kotelna.sk>. |