MJY-HUST opened a new issue, #2554:
URL: https://github.com/apache/brpc/issues/2554

   问题产生场景:
   当一个bthread(taskmeta中的attr.keytable_pool = 
null)的生命周期结束,且其拥有keytable实例时。在销毁keytable时会调用由用户创建bthread_key_create(bthread_key_t*
 key, void (*destructor)(void* 
data))中传入的destructor析构函数,如果destructor内部使用了bthread-mutex并挂起的话,bthread恢复后所在的task_group会发生变化。在现有的task_runner实现中,如果在return_keytable后不重新指定task_group的话,调用ending_sched(&g)会出现错误。
   
   疑问:
   1. 
destructor内部不能使用bthread-mutex吗?我没有在相关的文档或者代码中找到相关的说明。在destructor内部使用bthread-mutex的一种场景是(通过一个链表将所有的bthread-local变量串起来,便于统一操作,例如置为过期。在析构bthread-local时,需要加锁从链表中摘除该元素)。
   2. 如果支持使用的话,需要将
   g =  
BAIDU_GET_VOLATILE_THREAD_LOCAL(tls_task_group);移动到调用return_keytable后:也就是从task_group.cc
 line311 移动到line334。
   
   
   


-- 
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: dev-unsubscr...@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to