OK, I'll give it a shot over the weekend then. Achille Roussel +1 415 490 6339 > On May 13, 2014, at 1:01 AM, Martin Sustrik <sustrik@xxxxxxxxxx> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi Achille, > >> So the nn_reallomsg function should take in considerations the >> value of the reference counter in a message (from reading a bit of >> the nanomsg internal that's how I understand it works). In the case >> the counter is not one it would simply allocate a new buffer and >> copy the data. > > Ok. That makes sense. Are you going to implement that? > >> I'm wondering if there might be some race conditions here, unless >> nanomsg increases the reference counter of a message before >> delivering it to any socket (I guess so, otherwise there would be >> races on nn_freemsg already). > > The reference counter is adjusted using atomic operations, so it > should be thread-safe. >> >> That could also solve the issues raised in another thread about >> requesting padding at the end of a message... If the padding is >> small, in most cases the reallocation will simply change the >> message size without actually copying any data. > > Yes. Unless, of course, the buffer is shared as discussed previously. > > Martin > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iQEcBAEBAgAGBQJTcdFuAAoJENTpVjxCNN9YH4UIAJjSoKlwQdS/9eOOsLBJx2U8 > 0tMreOx6aYdQR4R0sCV5A7j9ZaSp6azO92i1L2+TI+0Fcob2FwTFPTYEBgLFBlsH > uOGYRGjWjEeNoImIQllBC3NcgSZgkTnDqomQRWbJJUTb3VBcNQxWlk90NHxQWwhX > dRXdGp/+3tpiC01YpJxccfs61wfZ2HBR3Mw91NIwKy08caE1rRR3PW509WhQIBNU > XR1humx/MFktGLPxUtbWPHCMEDib0qI6TazzvqYH0zrAbAhvqco9Rm1VdlToSFLe > 3w6qls1/1fATmpPT8IMPeDcFooaYQfipzTZdIIClOSZcGqnZ3q11j056KJfIl+w= > =LnK2 > -----END PGP SIGNATURE----- >