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

pthread_rwlock_t implementation is missing try-lock functions (IDFGH-7685) #9229

Closed
Spacechild1 opened this issue Jun 24, 2022 · 7 comments
Closed
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF

Comments

@Spacechild1
Copy link

ESP-IDF has recently added support for pthread_rwlock_t (32e3444), but strangely the try-lock functions pthread_wrlock_tryrdlock and pthread_wrlock_trywrlock are missing... I'm wondering why they have been omitted?

@Spacechild1 Spacechild1 added the Type: Feature Request Feature request for IDF label Jun 24, 2022
@espressif-bot espressif-bot added the Status: Opened Issue is new label Jun 24, 2022
@github-actions github-actions bot changed the title pthread_rwlock_t implementation is missing try-lock functions pthread_rwlock_t implementation is missing try-lock functions (IDFGH-7685) Jun 24, 2022
@0xjakob
Copy link
Collaborator

0xjakob commented Jun 27, 2022

@Spacechild1

I'm wondering why they have been omitted?

They simply haven't been implemented. The original feature request came from the Rust-community who needed only the simple functionality. I'll take a look at the code within the next few days to see if the implementation would be easy.

@0xjakob 0xjakob self-assigned this Jun 27, 2022
@Spacechild1
Copy link
Author

Spacechild1 commented Jun 27, 2022

Thanks!

to see if the implementation would be easy.

They are pretty easy to implement: instead of waiting on the condition variable, you would just unlock the resource mutex and return EBUSY. (And don't touch waiting_writers.) I can also make a PR if necessary.

@espressif-bot espressif-bot assigned 0xjakob and unassigned 0xjakob Jun 29, 2022
@svenstaro
Copy link

Has there been any progress on this? I think this functionality would be pretty neat to have. Speaking from a Rust perspective, it's actually required to make full use of the tracing ecosystem.

@elotom
Copy link

elotom commented Feb 2, 2023

I also encountered this problem. It would be nice to have this for the Rust ecosystem.

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Status: Selected for Development Issue is selected for development Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable labels Apr 13, 2023
@0xjakob
Copy link
Collaborator

0xjakob commented Apr 19, 2023

The try-lock functions have been merged into master. Feel free to take a look.

@svenstaro
Copy link

Looks like e7312cc is still not in any release. What's the policy here? What future release would this be contained in?

@0xjakob
Copy link
Collaborator

0xjakob commented Oct 31, 2023

Hi @svenstaro, it has been merged to master. This means it will go into the next release (v5.2), as well as all the following releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

5 participants