Skip to content
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

Feature request: !Send Ref #153

Closed
0xdeafbeef opened this issue Aug 1, 2021 · 1 comment
Closed

Feature request: !Send Ref #153

0xdeafbeef opened this issue Aug 1, 2021 · 1 comment

Comments

@0xdeafbeef
Copy link

Can we implement something like this for Ref under async or RefNotSend feature?

Use case:

async fn fast_computation(data: &str) {
    tokio::time::sleep(Duration::from_secs(1)).await;
    drop(data);
}

async fn test(map: &DashMap<String, String>, data: &str) {
    let value = match map.get(data) {
        None => {
            tokio::time::sleep(Duration::from_secs(10)).await;  // some heavy computation
        }
        Some(a) => fast_computation(a.value()).await, // deadlocks here
    };
}

If Ref was not Send, then this won't compile.

@xacrimon
Copy link
Owner

xacrimon commented Feb 6, 2022

Closed by #179 on v5. Release containing this will be put out later today.

@xacrimon xacrimon closed this as completed Feb 6, 2022
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

No branches or pull requests

2 participants