PJ_DEF(void) pjsua_stop_worker_threads(void)
{
    unsigned i;

    pjsua_var.thread_quit_flag = 1;

    /* Wait worker threads to quit: */
    for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) {
    	if (pjsua_var.thread[i]) {
    	    pj_status_t status;
    	    status = pj_thread_join(pjsua_var.thread[i]);
    	    if (status != PJ_SUCCESS) {
    		PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread"));
    		pj_thread_sleep(1000);
    	    }
    	    pj_thread_destroy(pjsua_var.thread[i]);
    	    pjsua_var.thread[i] = NULL;
    	}
    }
}
PJ_DEF(void) pjsua_stop_worker_threads(void)
{
    unsigned i;

    pjsua_var.thread_quit_flag = 1;

     
    for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) {
    	if (pjsua_var.thread[i]) {
    	    pj_status_t status;
    	    status = pj_thread_join(pjsua_var.thread[i]);
    	    if (status != PJ_SUCCESS) {
    		PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread"));
    		pj_thread_sleep(1000);
    	    }
    	    pj_thread_destroy(pjsua_var.thread[i]);
    	    pjsua_var.thread[i] = NULL;
    	}
    }
}