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

Sync feature flag #10

Open
bogzbonny opened this issue Oct 11, 2023 · 4 comments
Open

Sync feature flag #10

bogzbonny opened this issue Oct 11, 2023 · 4 comments

Comments

@bogzbonny
Copy link

Right now rhai-fs isn't sync (hence it's incompatible with sync users of rhai). Adding a sync feature which replicates Shared and Locked as in rhai and replacing current usages of Rc and RefCell with Shared and Locked would be useful.

@schungx
Copy link
Contributor

schungx commented Oct 11, 2023

Can we just use rhai::Shared and rhai::Locked instead?

I understand that the two APIs are slightly different but I use a few wrapper functions (such as get_shared_lock or something in Rhai to encapsulate them so they look exactly alike in code.

@schungx
Copy link
Contributor

schungx commented Oct 11, 2023

But I'm not sure if a file handle is Send + Sync... therefore does it even make sense to be sync?

@bogzbonny
Copy link
Author

Oh yeah that would be cool to just use the primitives directly within rhai. I can confirm that file handling IS sync as I just compiled and used pub type SharedFile = Arc<RwLock<File>>; functions in an async environment

@schungx
Copy link
Contributor

schungx commented Oct 12, 2023

@bogzbonny I suggest that you open a PR if you can.

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