Skip to content

Commit

Permalink
Bikeshed
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Jan 8, 2024
1 parent bf03fb3 commit 862b60c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private[effect] sealed abstract class WorkStealingThreadPool private ()
task: Runnable,
fallback: Scheduler): Runnable
private[effect] def canExecuteBlockingCode(): Boolean
private[effect] def prepareBlocking(): Unit
private[effect] def prepareForBlocking(): Unit
private[unsafe] def liveTraces(): (
Map[Runnable, Trace],
Map[WorkerThread, (Thread.State, Option[(Runnable, Trace)], Map[Runnable, Trace])],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,10 @@ private[effect] final class WorkStealingThreadPool(
* Prepares the current thread for running blocking code. This should be called only if
* [[canExecuteBlockingCode]] returns `true`.
*/
private[effect] def prepareBlocking(): Unit = {
private[effect] def prepareForBlocking(): Unit = {
val thread = Thread.currentThread()
val worker = thread.asInstanceOf[WorkerThread]
worker.prepareBlocking()
worker.prepareForBlocking()
}

/**
Expand Down
4 changes: 2 additions & 2 deletions core/jvm/src/main/scala/cats/effect/unsafe/WorkerThread.scala
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ private final class WorkerThread(
* There is no reason to enclose any code in a `try/catch` block because the only way this
* code path can be exercised is through `IO.delay`, which already handles exceptions.
*/
def prepareBlocking(): Unit = {
def prepareForBlocking(): Unit = {
val rnd = random

pool.notifyParked(rnd)
Expand Down Expand Up @@ -858,7 +858,7 @@ private final class WorkerThread(
* A mechanism for executing support code before executing a blocking action.
*/
override def blockOn[T](thunk: => T)(implicit permission: CanAwait): T = {
prepareBlocking()
prepareForBlocking()
thunk
}

Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/cats/effect/IOFiber.scala
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ private final class IOFiber[A](
if (ec.isInstanceOf[WorkStealingThreadPool]) {
val wstp = ec.asInstanceOf[WorkStealingThreadPool]
if (wstp.canExecuteBlockingCode()) {
wstp.prepareBlocking()
wstp.prepareForBlocking()

var error: Throwable = null
val r =
Expand Down

0 comments on commit 862b60c

Please sign in to comment.