We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1 if ((pool = (zv_threadpool_t *)malloc(sizeof(zv_threadpool_t))) == NULL){ goto err; } 动态申请pool的内存为什么没有释放? 2 if (pool->shutdown == immediate_shutdown) { break; } else if ((pool->shutdown == graceful_shutdown) && pool->queue_size == 0) { break; } 这里的意思是区别对待2种销毁线程池的方式.选择graceful_shutdown的方式是: 等执行完任务队列所有任务时所有线程再一起退出吗.? 我的意思是假设现在有最后一个任务,线程池里有3个线程,那么有1个线程在执行任务,另外2个在阻塞. 好,现在选择graceful_shutdown销毁线程池,有任务的线程会继续执行, 阻塞的被broad唤醒然后会再再次 cond_wait. 然后再被唤醒(因为前面是do_while), 以上,不知道我的理解对不对? 3 if (task == NULL) { pthread_mutex_unlock(&(pool->lock)); continue; } 在static void *threadpool_worker(void *arg)中加这几行代码是为什么呢?
if ((pool = (zv_threadpool_t *)malloc(sizeof(zv_threadpool_t))) == NULL){ goto err; }
if (pool->shutdown == immediate_shutdown) { break; } else if ((pool->shutdown == graceful_shutdown) && pool->queue_size == 0) { break; }
if (task == NULL) { pthread_mutex_unlock(&(pool->lock)); continue; }
希望博主赐教. thx.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1
if ((pool = (zv_threadpool_t *)malloc(sizeof(zv_threadpool_t))) == NULL){ goto err; }
动态申请pool的内存为什么没有释放?
2
if (pool->shutdown == immediate_shutdown) { break; } else if ((pool->shutdown == graceful_shutdown) && pool->queue_size == 0) { break; }
这里的意思是区别对待2种销毁线程池的方式.选择graceful_shutdown的方式是: 等执行完任务队列所有任务时所有线程再一起退出吗.?
我的意思是假设现在有最后一个任务,线程池里有3个线程,那么有1个线程在执行任务,另外2个在阻塞.
好,现在选择graceful_shutdown销毁线程池,有任务的线程会继续执行, 阻塞的被broad唤醒然后会再再次
cond_wait. 然后再被唤醒(因为前面是do_while),
以上,不知道我的理解对不对?
3
if (task == NULL) { pthread_mutex_unlock(&(pool->lock)); continue; }
在static void *threadpool_worker(void *arg)中加这几行代码是为什么呢?
希望博主赐教. thx.
The text was updated successfully, but these errors were encountered: