The context is created in two steps; the actual I/O threads are created only when the first socket is created. This lets us configure the context before creating sockets.
On Sun, Jan 12, 2014 at 4:15 PM, Kenneth Adam Miller <[email protected]> wrote: > Yes, it most definitely is in socket creation. > > > On Sun, Jan 12, 2014 at 9:12 AM, Kenneth Adam Miller > <[email protected]> wrote: >> >> 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 >> <[email protected]> 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! >> >> > > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
