chenBright commented on PR #2215:
URL: https://github.com/apache/brpc/pull/2215#issuecomment-1525295355
> > 需要考虑线程池退出问题吗?
>
> 这块参考了usercode backup pool的实现,它里面有个注释,所以我这块好像也得按照这个方式处理。 int
UserCodeBackupPool::Init() { // Like bthread workers, these threads never quit
(to avoid potential hang // during termination of program). for (int i = 0; i <
FLAGS_usercode_backup_threads; ++i) { pthread_t th; if (pthread_create(&th,
NULL, UserCodeRunner, this) != 0) { LOG(ERROR) << "Fail to create
UserCodeRunner"; return -1; } } return 0; }
UserCodeBackupPool是框架里使用的,进程运行时是不会析构的。
```c++
static UserCodeBackupPool* s_usercode_pool = NULL;
```
该PR里的UserCodeThreadPool是给用户使用的,UserCodeThreadPool有可能会析构,但是线程池里的线程没有退出,有crash的可能。
在UserCodeThreadPool析构函数中做一下stop and join操作,是不是合理一些呢?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]