-
Notifications
You must be signed in to change notification settings - Fork 551
blocking
and interruptible
on Scala Native
#4378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: series/3.x
Are you sure you want to change the base?
Conversation
Also fixes #4323 |
It is! Edit: caveat, it landed in SN 0.5.7, which we are struggling to upgrade to. |
private[effect] object InterruptThrowable { | ||
def apply(t: Throwable): Boolean = t match { | ||
case _: InterruptedException => true | ||
case _: ClosedByInterruptException => true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClosedByInterruptException
also landed in SN 0.5.7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Le sigh… Well, we'll remove my shims when we do.
ticked("realTimeInstant should return an Instant constructed from realTime") { | ||
implicit ticker => | ||
val op = for { | ||
now <- IO.realTimeInstant | ||
realTime <- IO.realTime | ||
} yield now.toEpochMilli == realTime.toMillis | ||
|
||
assertCompleteAs(op, true) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the duplicate test from the Native-specific test suite:
ticked("realTimeInstant should return an Instant constructed from realTime") { | |
implicit ticker => | |
val op = for { | |
now <- IO.realTimeInstant | |
realTime <- IO.realTime | |
} yield now.toEpochMilli == realTime.toMillis | |
assertCompleteAs(op, true) | |
} |
case ex: ClosedByInterruptException => throw ex | ||
case t if InterruptThrowable(t) => throw t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the lack of InterruptedException
here an oversight? Otherwise it seems like this is changing the semantic 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's incorporated in the matcher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I think that was unclear: the previous matcher checked only for ClosedByInterruptException
, but the new matcher now checks for both ClosedByInterruptException
and InterruptedException
. That's the change in semantic I'm referring to.
Fixes #4331
Fixes #4374
Closes #4360
This ports
interruptible
andblocking
to the shared JVM/Native cross-build structure. I had to split apartIOCompanion
a bit more since theCompletableFuture
stuff is still JVM-only. Is that implemented on SN now? I'm assuming not. The other weird caveat came from the specialClosedByInterruptException
semantics on JVM and its nonexistence on Native.