ACE_Thread_Semaphore * ACE_Malloc_Lock_Adapter_T<ACE_Thread_Semaphore>::operator () (const ACE_TCHAR *name) { ACE_Thread_Semaphore *p = 0; if (name == 0) ACE_NEW_RETURN (p, ACE_Thread_Semaphore (1, name), 0); else ACE_NEW_RETURN (p, ACE_Thread_Semaphore (1, ACE::basename (name, ACE_DIRECTORY_SEPARATOR_CHAR)), 0); return p; }
int KSG_Proactor_Listener_Task::start_task(int max_task) { _max_task = max_task; if(_max_task <= 0) _max_task = 1; if(_sem) { _sem->release(); _sem->remove(); delete _sem; } ACE_NEW_RETURN(_sem,ACE_Thread_Semaphore(_max_task),-1); for(int i = _max_task;i>0;i--) _sem->acquire(); ACE_DEBUG((LM_DEBUG,"准备启动线程...")); activate(THR_NEW_LWP|THR_JOINABLE,_max_task); return 0; }