[zeromq-dev] Problem with multi-threaded server on OS X using C
Steve Goodrich
zepedebo at yahoo.com
Tue Jul 23 18:10:43 CEST 2013
I set up an environment and compiled on gcc and it worked. I then set of on a journey of self discovery that led me to the conclusion that the culprit is lldb and gdb. By default, processes are run in the debugger under Xcode. I compiled the code by hand and ran it without out problems. If I run it in the debugger, I get the error. I will poke at it some more but it looks like the debugger is my problem.
Thanks for the reply and the help,
Steve Goodrich
LANDesk Software
________________________________
From: Martin Hurton <hurtonm at gmail.com>
To: Steve Goodrich <zepedebo at yahoo.com>; ZeroMQ development list <zeromq-dev at lists.zeromq.org>
Sent: Tuesday, July 23, 2013 2:09 AM
Subject: Re: [zeromq-dev] Problem with multi-threaded server on OS X using C
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
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130723/d4341b44/attachment.htm>
More information about the zeromq-dev
mailing list