Hello,

this is my first posting to this group and I'm in the process of writing 
a wrapper (for VASmalltalk - a Smalltalk dialect) around 0MQ and I like 
very much, what I've seen so far.

But after reading all the documentation I have problems with message 
structure "zmq_msg_t" and "zmq_msg_close()".

Actually I am not sure how long the lifetime of "zmq_msg_t" is.

Reading all the code examples the usage of this structure is like (from 
zhelpers.c):

static int
s_send (void *socket, char *string) {
     int rc;
     zmq_msg_t message;
     zmq_msg_init_size (&message, strlen (string));
     memcpy (zmq_msg_data (&message), string, strlen (string));
     rc = zmq_send (socket, &message, 0);
     zmq_msg_close (&message);
     return (rc);
}

There is storage allocated on the stack within this function for 
"message" and at the end of this function one calls zmq_msg_close().

But according to the documentation:

"The zmq_msg_close() function shall inform the ØMQ infrastructure that 
any resources associated with the message object referenced by msg are 
no longer required and may be released. Actual release of resources 
associated with the message object shall be postponed by ØMQ until all 
users of the message or underlying data buffer have indicated it is no 
longer required."

I interpret it, that 0MQ still may reference this structure (located at 
message), but after finishing this function, the address of the 
structure may be not available any more .... therefore it may be 
overwritten.

Can anyone give me any help here !?!?!

Thanks for considering answering this beginner question ....

Marten
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to