returning from method when spawned thread is ready in c++ : I am new to thread related concepts.I have program with main function where I call function a() that spawns a thread(NewThread) using boost.now as part of thread i do some initialization of some variable and then start a while(1) loop.
   

 I want give the control to function b() when control reaches inside while(1),


 currently it is reaching to b() without starting while loop.

Please guide me.


   
    void NewThread()
    {
        //initialization of some modules

        //infinite while loop
        while(1)
        {
        }

    }
     void a()
    {
       this->libThread = new boost::thread(boost::bind(&NewThread));
    }
     void b()
    {
       cout<<"function b";
    }
    int main()
    {
        a();
        b();
    }
