[zeromq-dev] Problem with multi-threaded server on OS X using C

Martin Hurton hurtonm at gmail.com
Tue Jul 23 11:09:18 CEST 2013


Hi Steve, do you get the same error when using GCC?

On Mon, Jul 22, 2013 at 5:22 PM, Steve Goodrich <zepedebo at yahoo.com> wrote:
> I have compiled the C multi-threaded server from the guide on OS X 10.8.4
> using LLVM 5.0. Everything runs fine. Then I add a call to system() in the
> worker thread so it looks like this:
>
> static void *
> worker_routine (void *context) {
> // Socket to talk to dispatcher
> void *receiver = zmq_socket (context, ZMQ_REP);
> zmq_connect (receiver, "inproc://workers");
> while (1) {
> char *string = s_recv (receiver);
> printf ("Received request: [%s]\n", string);
> free (string);
> // Do some 'work'
> sleep (1);
> system("ls");
> // Send reply back to client
> s_send (receiver, "World");
> }
> zmq_close (receiver);
> return NULL;
> }
>
> Once I do this, the s_send call fails. If I dig in a little, I am getting an
> ENOENT from the send call. I don't get this problem if I don't use the
> multithreaded example. I do have the same problem if I move the threads to
> GSD queues or change the system() call to NSTask
>
> Any ideas?
>
> Thanks,
> Steve Goodrich
> LANDesk Software
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list