[zeromq-dev] Important: backward incompatible changes for 0MQ/3.0!

Douglas Creager dcreager at dcreager.net
Thu Mar 24 19:12:39 CET 2011


> Yes, something like this can be used internally to pass context when 
> creating a new message body for a message being received.
> 
> However, let's figure out how the API should look like and think about 
> the implemetation afterwards.

I would suggest the following:


// Change the function that's used to allocate any memory
// needed by a context.

typedef void *
(*zmq_alloc_func_t)(void *user_data, void *old_ptr, size_t old_size, size_t new_size);

void
zmq_ctx_set_allocator(void *ctx, zmq_alloc_func_t alloc_func, void *user_data);


// Add a ctx parameter to each zmq_msg function:

int zmq_msg_init(void *ctx, zmq_msg_t *msg);
int zmq_msg_init_data(void *ctx, zmq_msg_t *msg,
                       void *data, size_t size,
                       zmq_free_fn *ffn, void *hint);

// etc.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: This is a digitally signed message part
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110324/7db29c19/attachment.sig>


More information about the zeromq-dev mailing list