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

RwLock miss try_read and try_write method #2284

Closed
Sherlock-Holo opened this issue Feb 29, 2020 · 0 comments · Fixed by #3400
Closed

RwLock miss try_read and try_write method #2284

Sherlock-Holo opened this issue Feb 29, 2020 · 0 comments · Fixed by #3400
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-sync Module: tokio/sync

Comments

@Sherlock-Holo
Copy link

Version 0.2.13

└── tokio v0.2.13
    └── tokio-macros v0.2.5

Platform

archlinux x64

Subcrates

Description

I try

use tokio::sync::RwLock;

#[tokio::main]
async fn main() {
    let rw_lock = RwLock::new(1);
    
    rw_lock.try_read();
}

It should compile well. But cargo report

method not found in tokio::sync::rwlock::RwLock<{integer}>

I read the doc, RwLock doesn't have try_read or try_write, if I want to try to acquire a read lock or write lock but don't block when acquire failed, what should I do

@Darksonn Darksonn added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. E-help-wanted Call for participation: Help is requested to fix this issue. M-sync Module: tokio/sync labels Apr 29, 2020
pingw33n pushed a commit to pingw33n/tokio that referenced this issue May 20, 2020
pingw33n pushed a commit to pingw33n/tokio that referenced this issue May 20, 2020
pingw33n pushed a commit to pingw33n/tokio that referenced this issue May 20, 2020
pingw33n pushed a commit to pingw33n/tokio that referenced this issue May 20, 2020
@Darksonn Darksonn removed the E-help-wanted Call for participation: Help is requested to fix this issue. label Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-sync Module: tokio/sync
Projects
None yet
2 participants