wangrufeng commented on issue #286:
URL: https://github.com/apache/brpc/issues/286#issuecomment-2451944498

   > event.wait如果用的不是bthread同步原语, 那么可能会把所有的worker线程全部阻塞了, 导致没有线程可以执行task. 
2018-03-28 17:16 GMT+08:00 闫梓祯@智能引擎 <notificati...@github.com>:
   > […](#)
   > 如果是单个execution_queue,执行都没有问题;如果是两个的话(task和execute函数都是不同的),就会出现传进去task, 
但是并没有在execute中收到的问题,请问这个是我自己实现的问题吗?下面是简化后的代码 //在server端启动时,初始化eq 
bthread::ExecutionQueueOptions options1; 
bthread::execution_queue_start(&queue_id1_, &options, ex1, meta1_); 
bthread::ExecutionQueueOptions options2; 
bthread::execution_queue_start(&queue_id2_, &options2, ex2, meta2_);    
//ex的函数实现 int ex1(void *meta, bthread::TaskIterator <Task1> &iter_task) { 
AddMeta *add_mata = (AddMeta *) meta; if (iter_task.is_queue_stopped()) { 
return 0; } for (; iter_task; ++iter_task) { iter_task->event->Signal(); } 
return 0; } // 在server 端 rpc接口,使用如下代码添加task butil::WaitableEvent 
event(true,false); Task1 task(&event); auto ret = 
bthread::execution_queue_execute(queue_id1_, task); 
DLOG(INFO)<<"execution_queue_
 execute ret "<<ret; event.Wait(); //如果开启多个eq,代码执行一段时间后,都会等待在这里 — You are 
receiving this because you are subscribed to this thread. Reply to this email 
directly, view it on GitHub <#286>, or mute the thread 
<https://github.com/notifications/unsubscribe-auth/AGfYT-aYBFoiQaMTO40R3b_2ZKvnjXnjks5ti1TngaJpZM4S-SZX>
 .
   
   可以再给详细解释下吗? 我也遇到了在brpc 
worker线程中使用butil::WaitableEvent造成死锁的问题,butil::WaitableEvent正确的使用方式是怎样的?


-- 
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

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