Skip to content

Commit

Permalink
Guard againstmultiple wstps
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Dec 28, 2022
1 parent 6c4a9d1 commit 6581dc4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ private[effect] final class WorkStealingThreadPool(

if (thread.isInstanceOf[WorkerThread]) {
val worker = thread.asInstanceOf[WorkerThread]
if (worker.isOwnedBy(pool)) ioa
else IO.cede *> ioa
if (worker.isOwnedBy(pool)) // we're good
ioa
else // possibly a blocking worker thread, possibly on another wstp
IO.cede *> ioa.evalOn(pool)
} else ioa.evalOn(pool)
}
}
Expand Down

0 comments on commit 6581dc4

Please sign in to comment.