Skip to content
Snippets Groups Projects
Commit 13b4bd58 authored by Nicky Dasmijn's avatar Nicky Dasmijn
Browse files

Make sure coproc gets destroyed after each iteration.

Making coproc scoped to the for loop will make sure the destructor gets
called every loop iteration. Keeping it's scope outside the for loop
means the pointer keeps valid till the next assigment that happens
inside pop_wait_for when it gets assigned a new value.

Triggering the dtor inside pop_wait_for can lead to deadlock when inside
the dtor a coroutine tries to call enqueueCoprocedure (this happens).
enqueueCoprocedure then will try to grab the lock for try_push but this
lock is still held by pop_wait_for.
parent 003ba682
No related branches found
No related tags found
No related merge requests found
...@@ -342,10 +342,10 @@ void LLCoprocedurePool::coprocedureInvokerCoro( ...@@ -342,10 +342,10 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
CoprocQueuePtr pendingCoprocs, CoprocQueuePtr pendingCoprocs,
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter)
{ {
QueuedCoproc::ptr_t coproc;
boost::fibers::channel_op_status status;
for (;;) for (;;)
{ {
QueuedCoproc::ptr_t coproc;
boost::fibers::channel_op_status status;
{ {
LLCoros::TempStatus st("waiting for work for 10s"); LLCoros::TempStatus st("waiting for work for 10s");
status = pendingCoprocs->pop_wait_for(coproc, std::chrono::seconds(10)); status = pendingCoprocs->pop_wait_for(coproc, std::chrono::seconds(10));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment