Skip to content

Tracking Issue for is_disconnected functions for mpsc and mpmc channels #153668

@LevitatingBusinessMan

Description

@LevitatingBusinessMan

Feature gate: #![feature(mpsc_is_disconnected)] and #![feature(mpmc_channel)]

This is a tracking issue for the is_disconnected methods on mpsc and mpmc channels.

With these methods you'll be able to check if all Sender/Receivers on a channel have disconnected.

Public API

#![feature(mpsc_is_disconnected)]

use std::sync::mpsc::channel;

let (tx, rx) = channel::<i32>();
assert!(!tx.is_disconnected());
drop(rx);
assert!(tx.is_disconnected());

Steps / History

(Remember to update the S-tracking-* label when checking boxes.)

Unresolved Questions

  • What's the best way to document this in a way that prevents people from creating race conditions.
  • Will std get the ability to re-connect channels? If so what does that mean for this feature?
  • Can we add a clippy feature to detect the if !tx.is_disconnected() { tx.send() } form.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions