I created a new thread as follows
m_pLoginThread = new boost::thread(boost::bind(&CCCP::LoginThread, this));

void CCCP::LoginThread(void){
    /*
    LoginThread
    when we start a session with a slave, this process is started and will be done, once
    session login is done.
    */
   
    int nSendResult = 0;
    m_bConnectThreadActive = true;
    while(m_bConnectThreadActive){
        nSendResult = SessionLogin();
        if(nSendResult == 0){
            //the message has been acknowledged. so get out
            m_bConnectThreadActive = false;
            break;
        }       
        Sleep(25L);
    }//active while the threadactive is true
   
}
int CCCP::SessionLogin(void){
    /*
    called by: ConnectThread
    calls : SendAndWait, CCPConnect, CCPExchangeID, GetSeedData
    returns : 0 is all is done to connect to the slave, -1 if not successful.
    1 for part success
    */
   //here i do a lot of other activities and once it is complete i call the function below
    OnSuccessfulLogin();
    return 0;
}
void CCCP::OnSuccessfulLogin(void){
    /*
    OnSuccessfulLogin
    called once login process is successful.
    first we kill the connectthread process
    once successful, we need to make sure that we find more information about the daq list this slave
    will allow.
    so we do that by calling the function StartDAQThread
    */
if(m_pLoginThread){
        m_pLoginThread->join();
        delete m_pLoginThread;
        m_pLoginThread = NULL;
    }
   
}

the above code kind of gets deadlocked in m_pLoginThread->join(),
i guess this is because this is part of the thread loginthread and the join waits for the thread to wait, but it won't be over till this function is returned. i'm in a deadlock.

i wanted to know, how do i end a thread or process when i'm in the same thread.

thanks
--
jc (jayachandran kamaraj)