Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Document guarantee: sync_channel send() ⇒ immediate try_recv() visibility. #146135

Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
@jhfrontz

Description

Location (URL)

Maybe https://doc.rust-lang.org/std/sync/mpsc/fn.sync_channel.html

Summary

Request: Make explicit in std::sync::mpsc::sync_channel docs that after Sender::send returns Ok(()), the message is enqueued such that an immediate Receiver::try_recv() on the same channel cannot return Empty.

Rationale: This is relied on for tests (where code calls send() and the test immediately calls try_recv() on the same channel to assert a message was produced). Implementation appears to already behave this way, but the guarantee isn’t stated. It's conceivable that in a different environment that an alternate implementation might be used that introduces the potential for messaging latency.

Ask: Treat this as a normative docs change.

(Reference: https://stackoverflow.com/questions/79753705/rust-mpscsync-channel-after-send-returns-can-try-recv-still-return-empty )

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /