Hi all,


Im using apr to throw new threads for making callbacks. My problem is that when I have made exactly 632 calls to the function throwOnMessage, the thread onMessage is not throwed by it anymore, the thread is not created (I've put traces into the first instruction and it is not executed). This code shuld work?


/////////////////////////////////////////////////////////////////////////////////////////
// thread that sends message to user
/////////////////////////////////////////////////////////////////////////////////////////
static void* APR_THREAD_FUNC onMessage(apr_thread_t *thd, void *data){

ActiveCallbackData* activeCallbackData=NULL;
if (data){
activeCallbackData=(ActiveCallbackData*)data;
if (activeCallbackData){
ActiveCallback::getInstance()->registerThread(activeCallbackData->getThreadId(),thd);
ActiveManager::getInstance()->onMessageCallback(activeCallbackData->getActiveMessage());
}
}
//deleting thread from the map
ActiveCallback::getInstance()->unregisterThread(activeCallbackData->getThreadId());
//deleting object
delete activeCallbackData;
//deleting thread
apr_thread_exit(thd, APR_SUCCESS);
//returning
return NULL;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////

void ActiveCallback::throwOnMessage(ActiveMessage& activeMessageR){

//creating object that will be stored by the thread
ActiveCallbackData* activeCallbackData=new ActiveCallbackData(++threadId,activeMessageR);
//vars for threads
apr_thread_t *thd_arr;
//thread atts
apr_threadattr_t *thd_attr;
//creating thread attributes
apr_threadattr_create(&thd_attr, mp);
//creating the thread
apr_thread_create(&thd_arr, thd_attr, onMessage, (void*)activeCallbackData, mp);
}

--
Óscar Pernas Plaza.