Skip to content

线程池销毁线程函数 #12

@kkndme-wx

Description

@kkndme-wx

大佬,线程池销毁线程这里
void Thread_pool::destory_thread(){
pthread_t tid = pthread_self();
for(int i = 0; i < m_max_num; i++){
if(thread_compose[i] == tid){
std::cout << "threadExit() function: thread "
<< std::to_string(pthread_self()) << " exiting..." << std::endl;
}
thread_compose[i] = 0;
break;
}
pthread_exit(nullptr);
}
的thread_compose[i] = 0;
break;
是不是应该放在if判断里面呀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions