Skip to content

Commit 3e17905

Browse files
authored
Merge pull request #4312 from typelevel/release/3.6.0-major
Merge changes from 3.6.0 into series/3.x
2 parents 71b7d59 + da98d48 commit 3e17905

File tree

15 files changed

+98
-52
lines changed

15 files changed

+98
-52
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
## Getting Started
1313

14-
- Wired: **3.5.7**
14+
- Wired: **3.6.0**
1515
- Tired: **2.5.5** (end of life)
1616

1717
```scala
18-
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.7"
18+
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.6.0"
1919
```
2020

2121
The above represents the core, stable dependency which brings in the entirety of Cats Effect. This is *most likely* what you want. All current Cats Effect releases are published for Scala 2.12, 2.13, 3.2, and Scala.js 1.13.
@@ -30,22 +30,22 @@ Depending on your use-case, you may want to consider one of the several other mo
3030

3131
```scala
3232
libraryDependencies ++= Seq(
33-
"org.typelevel" %% "cats-effect-kernel" % "3.5.7",
34-
"org.typelevel" %% "cats-effect-laws" % "3.5.7" % Test)
33+
"org.typelevel" %% "cats-effect-kernel" % "3.6.0",
34+
"org.typelevel" %% "cats-effect-laws" % "3.6.0" % Test)
3535
```
3636

3737
If you're a middleware framework (like [Fs2](https://fs2.io/)), you probably want to depend on **std**, which gives you access to `Queue`, `Semaphore`, and much more without introducing a hard-dependency on `IO` outside of your tests:
3838

3939
```scala
4040
libraryDependencies ++= Seq(
41-
"org.typelevel" %% "cats-effect-std" % "3.5.7",
42-
"org.typelevel" %% "cats-effect" % "3.5.7" % Test)
41+
"org.typelevel" %% "cats-effect-std" % "3.6.0",
42+
"org.typelevel" %% "cats-effect" % "3.6.0" % Test)
4343
```
4444

4545
You may also find some utility in the **testkit** and **kernel-testkit** projects, which contain `TestContext`, generators for `IO`, and a few other things:
4646

4747
```scala
48-
libraryDependencies += "org.typelevel" %% "cats-effect-testkit" % "3.5.7" % Test
48+
libraryDependencies += "org.typelevel" %% "cats-effect-testkit" % "3.6.0" % Test
4949
```
5050

5151
Cats Effect provides backward binary compatibility within the 2.x and 3.x version lines, and both forward and backward compatibility within any major/minor line. This is analogous to the versioning scheme used by Cats itself, as well as other major projects such as Scala.js. Thus, any project depending upon Cats Effect 2.2.1 can be used with libraries compiled against Cats Effect 2.0.0 or 2.2.3, but *not* with libraries compiled against 2.3.0 or higher.

core/jvm/src/main/scala/cats/effect/unsafe/SelectorSystem.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ final class SelectorSystem private (provider: SelectorProvider) extends PollingS
8888
if (cb != null) {
8989
cb(value)
9090
fibersRescheduled = true
91-
if (error ne null) poller.countSucceededOperation(readyOps)
91+
if (error eq null) poller.countSucceededOperation(readyOps)
9292
else poller.countErroredOperation(node.interest)
9393
} else {
9494
poller.countCanceledOperation(node.interest)

core/jvm/src/main/scala/cats/effect/unsafe/WorkStealingThreadPool.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ import scala.concurrent.duration.{Duration, FiniteDuration}
3939

4040
import java.time.Instant
4141
import java.time.temporal.ChronoField
42-
import java.util.Comparator
43-
import java.util.concurrent.{ConcurrentSkipListSet, ThreadLocalRandom}
42+
import java.util.concurrent.{LinkedTransferQueue, ThreadLocalRandom}
4443
import java.util.concurrent.atomic.{
4544
AtomicBoolean,
4645
AtomicInteger,
@@ -132,8 +131,8 @@ private[effect] final class WorkStealingThreadPool[P <: AnyRef](
132131
*/
133132
private[this] val state: AtomicInteger = new AtomicInteger(threadCount << UnparkShift)
134133

135-
private[unsafe] val cachedThreads: ConcurrentSkipListSet[WorkerThread[P]] =
136-
new ConcurrentSkipListSet(Comparator.comparingInt[WorkerThread[P]](_.nameIndex))
134+
private[unsafe] val cachedThreads: LinkedTransferQueue[WorkerThread[P]] =
135+
new LinkedTransferQueue
137136

138137
/**
139138
* The shutdown latch of the work stealing thread pool.
@@ -751,7 +750,7 @@ private[effect] final class WorkStealingThreadPool[P <: AnyRef](
751750

752751
var t: WorkerThread[P] = null
753752
while ({
754-
t = cachedThreads.pollFirst()
753+
t = cachedThreads.poll()
755754
t ne null
756755
}) {
757756
t.interrupt()

core/jvm/src/main/scala/cats/effect/unsafe/WorkerThread.scala

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -727,30 +727,19 @@ private[effect] final class WorkerThread[P <: AnyRef](
727727
metrics = null
728728
transferState = null
729729

730-
// Add this thread to the cached threads data structure, to be picked up
731-
// by another thread in the future.
732-
pool.cachedThreads.add(this)
733730
try {
731+
// Try to transfer this thread via the cached threads data structure, to be picked up
732+
// by another thread in the future.
734733
val len = runtimeBlockingExpiration.length
735734
val unit = runtimeBlockingExpiration.unit
736-
var newState = stateTransfer.poll(len, unit)
737-
if (newState eq null) {
738-
// The timeout elapsed and no one woke up this thread. Try to remove
739-
// the thread from the cached threads data structure.
740-
if (pool.cachedThreads.remove(this)) {
741-
// The thread was successfully removed. It's time to exit.
742-
pool.blockedWorkerThreadCounter.decrementAndGet()
743-
return
744-
} else {
745-
// Someone else concurrently stole this thread from the cached
746-
// data structure and will transfer the data soon. Time to wait
747-
// for it again.
748-
newState = stateTransfer.take()
749-
init(newState)
750-
}
751-
} else {
752-
// Some other thread woke up this thread. Time to take its place.
735+
if (pool.cachedThreads.tryTransfer(this, len, unit)) {
736+
// Someone accepted the transfer of this thread and will transfer the state soon.
737+
val newState = stateTransfer.take()
753738
init(newState)
739+
} else {
740+
// The timeout elapsed and no one woke up this thread. It's time to exit.
741+
pool.blockedWorkerThreadCounter.decrementAndGet()
742+
return
754743
}
755744
} catch {
756745
case _: InterruptedException =>
@@ -939,7 +928,7 @@ private[effect] final class WorkerThread[P <: AnyRef](
939928
// Set the name of this thread to a blocker prefixed name.
940929
setName(s"$prefix-$nameIndex")
941930

942-
val cached = pool.cachedThreads.pollFirst()
931+
val cached = pool.cachedThreads.poll()
943932
if (cached ne null) {
944933
// There is a cached worker thread that can be reused.
945934
val idx = index

docs/core/native-image.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ThisBuild / scalaVersion := "2.13.8"
3333

3434
lazy val root = (project in file(".")).enablePlugins(NativeImagePlugin).settings(
3535
name := "cats-effect-3-hello-world",
36-
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.7",
36+
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.6.0",
3737
Compile / mainClass := Some("com.example.Main"),
3838
nativeImageOptions += "--no-fallback",
3939
nativeImageVersion := "22.1.0" // It should be at least version 21.0.0

docs/core/scala-native.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ lazy val root = project.in(file("."))
2222
.enablePlugins(ScalaNativePlugin)
2323
.settings(
2424
name := "cats-effect-3-hello-world",
25-
libraryDependencies += "org.typelevel" %%% "cats-effect" % "3.5.7",
25+
libraryDependencies += "org.typelevel" %%% "cats-effect" % "3.6.0",
2626
Compile / mainClass := Some("com.example.Main")
2727
)
2828

docs/core/test-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ For those migrating code from Cats Effect 2, `TestControl` is a considerably mor
2828
In order to use `TestControl`, you will need to bring in the **cats-effect-testkit** dependency:
2929

3030
```scala
31-
libraryDependencies += "org.typelevel" %% "cats-effect-testkit" % "3.5.7" % Test
31+
libraryDependencies += "org.typelevel" %% "cats-effect-testkit" % "3.6.0" % Test
3232
```
3333

3434
## Example

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ title: FAQ
99

1010
```scala-cli
1111
//> using scala "2.13.8"
12-
//> using lib "org.typelevel::cats-effect::3.5.7"
12+
//> using lib "org.typelevel::cats-effect::3.6.0"
1313
1414
import cats.effect._
1515

docs/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Getting Started
66
Add the following to your **build.sbt**:
77

88
```scala
9-
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.7"
9+
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.6.0"
1010
```
1111

1212
Naturally, if you're using ScalaJS, you should replace the double `%%` with a triple `%%%`. If you're on Scala 2, it is *highly* recommended that you enable the [better-monadic-for](https://github.com/oleg-py/better-monadic-for) plugin, which fixes a number of surprising elements of the `for`-comprehension syntax in the Scala language:
@@ -68,7 +68,7 @@ We will learn more about constructs like `start` and `*>` in later pages, but fo
6868
Of course, the easiest way to play with Cats Effect is to try it out in a Scala REPL. We recommend using [Ammonite](https://ammonite.io/#Ammonite-REPL) for this kind of thing. To get started, run the following lines (if not using Ammonite, skip the first line and make sure that Cats Effect and its dependencies are correctly configured on the classpath):
6969

7070
```scala
71-
import $ivy.`org.typelevel::cats-effect:3.5.7`
71+
import $ivy.`org.typelevel::cats-effect:3.6.0`
7272

7373
import cats.effect.unsafe.implicits._
7474
import cats.effect.IO

docs/migration-guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ Cats Effect 3 splits the code dependency into multiple modules. If you were prev
8181
The current non-test modules are:
8282

8383
```scala
84-
"org.typelevel" %% "cats-effect-kernel" % "3.5.7",
85-
"org.typelevel" %% "cats-effect-std" % "3.5.7",
86-
"org.typelevel" %% "cats-effect" % "3.5.7",
84+
"org.typelevel" %% "cats-effect-kernel" % "3.6.0",
85+
"org.typelevel" %% "cats-effect-std" % "3.6.0",
86+
"org.typelevel" %% "cats-effect" % "3.6.0",
8787
```
8888

8989
- `kernel` - type class definitions, simple concurrency primitives
@@ -96,7 +96,7 @@ The current non-test modules are:
9696
libraryDependencies ++= Seq(
9797
//...
9898
- "org.typelevel" %% "cats-effect" % "2.4.0",
99-
+ "org.typelevel" %% "cats-effect" % "3.5.7",
99+
+ "org.typelevel" %% "cats-effect" % "3.6.0",
100100
//...
101101
)
102102
```

0 commit comments

Comments
 (0)