Skip to content

Mark types Sendable #83

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

Merged
merged 6 commits into from
Jan 31, 2023
Merged

Mark types Sendable #83

merged 6 commits into from
Jan 31, 2023

Conversation

ktoso
Copy link
Member

@ktoso ktoso commented Jan 30, 2023

Resolves #79

cc @fabianfett

@ktoso ktoso requested a review from fabianfett January 30, 2023 23:33
@ktoso ktoso added this to the 0.4.0 milestone Jan 30, 2023
@ktoso ktoso force-pushed the wip-sendable branch 4 times, most recently from 8982b6c to f335a11 Compare January 31, 2023 02:44
Copy link
Member

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pushing this. One bigger question and some nits.

extension SpanAttributes: Sendable {}
extension SpanAttribute: @unchecked Sendable {}
extension SpanStatus: Sendable {}
extension SpanEvent: @unchecked Sendable {} // unchecked because of DispatchWallTime
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is DispatchWallTime used for locking?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, for the "wall time" time type. Swift's Clocks are missing functionality and we would have to require 5.7 so sadly it's a no go either way... Though I'm still looking into using Swift's clock types

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but why is it "unchecked because of DispatchWallTime"? Is DispatchWallTime not marked as Sendable? Shouldn't we use @preconcurrency in that case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I just moved to that in e3c5bc1 (#83) :)

@ktoso ktoso force-pushed the wip-sendable branch 4 times, most recently from 6997271 to c31a43f Compare January 31, 2023 13:24
@ktoso
Copy link
Member Author

ktoso commented Jan 31, 2023

Nailed it now, I think... Last look @fabianfett ? :)


#if compiler(>=5.6.0)
extension DynamicTracepointTestTracer: @unchecked Sendable {} // only intended for single threaded testing {}
extension DynamicTracepointTestTracer.TracepointSpan: @unchecked Sendable {} // only intended for single threaded testing {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the {} suffix here is unnecessary?


#if compiler(>=5.6.0)
extension TracedLockPrintlnTracer: Sendable {}
extension TracedLockPrintlnTracer.TracedLockPrintlnSpan: @unchecked Sendable {} // only intended for single threaded testing {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for {} here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, cleaned up!

@ktoso ktoso merged commit 1aff1f1 into main Jan 31, 2023
@ktoso ktoso deleted the wip-sendable branch January 31, 2023 22:40
@ktoso ktoso modified the milestones: 0.4.0, 1.0.0-beta.1 Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Span should be marked as Sendable
4 participants