[zeromq-dev] Thread creation location in source

Kenneth Adam Miller kennethadammiller at gmail.com
Sun Jan 12 16:12:41 CET 2014

Actually, I found the location of the thread creation function just a
little after I sent this. It's actually in zmq::thread_t::start. I put a
cout function there, and although I can see where it runs it prints what I
gave it to print, I still don't see the link in the code between context
creation and when the thread start function gets called...

I think it has to do with socket creation. I'm going to investigate that as
my next go at it.

On Sun, Jan 12, 2014 at 6:56 AM, Kenneth Adam Miller <
kennethadammiller at gmail.com> wrote:

> I was told that it is in the context creation that threads are created,
> but so far I haven't found it.
> I looked through the zmq.cpp file's new_context_t function, which is
> called to construct a new context just as I was told.
> new_context_t had nothing to do pertaining to thread creation, so I traced
> it down to the ctx_t object constructor. I found that it set some
> parameters to default values, and that it didn't descend from another
> object but that all of these parameters were not threads. The body of the
> ctx_t constructor contains only getpid.
> It isn't until you get into the socket creation part that it starts
> creating threads. But these are io_thread_t types. I went into it's
> constructor and found that it doesn't create any threads. It isn't until
> I've gotten to the thread.cpp files that I see threads creation of the type
> where concurrency really occurs. I may not have found the right place yet
> in source (there's a lot, & I'm new), but is that where I need to start, in
> thread.cpp?
> It doesn't make sense to me, because I even went so far as to compile and
> run the hellow world server and client examples, and to place some cout
> calls in the appropriate constructors:
> std::cout << "Hooha" << std::endl;    //in io_thread.cpp io_thread_t
> constructor, which it showed
> and
> std::cout << "har har" << std::endl;  //in thread.cpp thread_t start
> function
> I even put a few lines in the constructor of thread_t objects. I still
> can't for the life of me find the place where internal background threads
> get started by zmq!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140112/fb772031/attachment.htm>

More information about the zeromq-dev mailing list