Skip to content

DispatchTimeInterval is not Sendable #787

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

Closed
NachoSoto opened this issue Apr 10, 2023 · 4 comments · Fixed by #788
Closed

DispatchTimeInterval is not Sendable #787

NachoSoto opened this issue Apr 10, 2023 · 4 comments · Fixed by #788
Assignees
Labels

Comments

@NachoSoto
Copy link

Description
For example:

Non-sendable type 'DispatchTimeInterval' passed in implicitly asynchronous call to main actor-isolated function cannot cross actor boundary

Is there a reason why DispatchTimeInterval shouldn't be marked as Sendable? It's an immutable value type.

Environment

  • Swift compiler version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
  • Xcode version: Xcode 14.3 (14E222b)
@NachoSoto NachoSoto added the bug label Apr 10, 2023
NachoSoto referenced this issue in RevenueCat/purchases-ios Apr 10, 2023
I expected it to be marked `Sendable` in the next version of Swift, but it still hasn't so I filed https://github.com/apple/swift/issues/65044.
`DispatchTimeInterval` is a value type, so it's safe to do this. I don't want to remove the `#if swift` version check because I expect it to be marked `Sendable` in a future version.
@ktoso
Copy link
Contributor

ktoso commented Apr 21, 2023

Hi there, thanks for reporting, that's definitely something to be addressed.

Generally dispatch is not governed "by Swift" so this isn't the right place to report but I'll reach out and see what we can do.

At the same time, we'll need to do the change for corelibs dispatch for non apple platforms over here: https://github.com/apple/swift-corelibs-libdispatch/blob/main/src/swift/Time.swift

@ktoso ktoso self-assigned this Apr 21, 2023
@ktoso
Copy link
Contributor

ktoso commented Apr 21, 2023

Actually, maybe best to move this issue to corelibs-dispatch, allow me to do that.

@ktoso ktoso transferred this issue from swiftlang/swift Apr 21, 2023
@ktoso
Copy link
Contributor

ktoso commented Apr 21, 2023

Tagging @PriyaAvhad who has looked into this

MaxDesiatov added a commit that referenced this issue Apr 21, 2023
This is an `enum` with associated values of `Int` type that are all `Sendable`, so should be safe mark the whole `enum` as such.

Resolves #787.
MaxDesiatov added a commit that referenced this issue Apr 21, 2023
This is an `enum` with associated values of `Int` type that are all `Sendable`, so should be safe mark the whole `enum` as such.

This change is low to no risk for 5.9 as it's additive and doesn't touch any other types or functions.

Resolves #787.
@ktoso
Copy link
Contributor

ktoso commented Apr 25, 2023

This has been merged to main and 5.9 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants