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

Steve Goodrich zepedebo at yahoo.com
Mon Jul 22 17:22:53 CEST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130722/d7fb7862/attachment.htm>


More information about the zeromq-dev mailing list