[zeromq-dev] what do I do bad with zmq_threadstart ?

Laurent Alebarde l.alebarde at free.fr
Tue Oct 22 18:29:25 CEST 2013


Hi Devs,

I am trying to use zmq_threadstart. My first test passing ctx as args 
works, but I need now to pass two arguments. So I tried many ways and 
all the time it ends with a compilor insult :

error: invalid conversion from 'void (*)(void**)' to 'void (*)(void*)' 
[-fpermissive]
In file included from ../tests/testutil.hpp:24:0,
                  from ../tests/test_concurrency_parano.cpp:20:
../tests/../include/zmq_utils.h:94:18: error:   initializing argument 1 
of 'void* zmq_threadstart(void (*)(void*), void*)' [-fpermissive]
make: *** [tests/test_concurrency_parano.o] Error 1

Here is my code exerpt :

struct arg_t {
     void* ctx;
     uint8_t id[8];
};

     for (int i = 0; i < QT_CLIENTS; i++)
     {
         arg_t* args = (arg_t*) malloc(sizeof (arg_t)); // it is up to 
the thread to free it
         args->ctx = ctx;

         int rc = build_test_stuff(i, args->id);
         assert (rc == 0);

         // start client thread with id
         threads[i] = zmq_threadstart  (&client_task, args);
     }

I read many posts on stackoverflow and elsewhere with the same problem 
with pthread_create, but it has not helped me.

Any idea please ?

Laurent

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131022/879c7a02/attachment.htm>


More information about the zeromq-dev mailing list