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

Draft : add an async implementation of RefCell #95

Closed
wants to merge 2 commits into from

Conversation

gwen-lg
Copy link

@gwen-lg gwen-lg commented Jan 14, 2025

This is a draft to get comment.

During my experience of implementing puffin server on only one thread with async management (https://github.com/gwen-lg/puffin/commits/async_client_connecting_local/),
I was confronted with the risk of problem with usage of await during borrow of RefCell, so I have search for an async version of RefCell, but not found, so I have tried to implement myself.
As I was in a single thread context (with LocalExecutor), use RwLock seems not the most adapted.

I have in progress test to use it here : gwen-lg/puffin@934209e

Are you interested to add a RefCell in async-lock ?
If yes, have you some remark on the work ? On how to transform the PoC into "ready to include" work ?

it's allow to share data between async tasks one one thread (with local
executor)
@notgull
Copy link
Member

notgull commented Jan 15, 2025

I think this type is already implemented as unsend::lock::RwLock.

@gwen-lg
Copy link
Author

gwen-lg commented Jan 17, 2025

@notgull Thank's for the information. I have watch it (but not tested for now) and seems good.
Question: Isn't it still interesting to have the functionality included in the crate async-std ?

@notgull
Copy link
Member

notgull commented Jan 19, 2025

That would be up to the async-std team, of which I am not a part. Not sure what their stance on new APIs is.

@gwen-lg
Copy link
Author

gwen-lg commented Jan 19, 2025

Ok @notgull, and to be associate with LocalExecutor ?

@gwen-lg gwen-lg closed this Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants