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

Add multithreaded example #933

Merged
merged 4 commits into from
Feb 3, 2025
Merged

Conversation

quietlychris
Copy link
Contributor

I've seen a couple questions pop up in the issues about using redb in a multi-threaded context or async-task context such as #555. I thought it might be useful to have an example of what that might look like. If anything's incorrect or there are changes that would make this more representative, just let me know!

@cberner
Copy link
Owner

cberner commented Jan 13, 2025

I think the example would be better if you had some, say 8, threads performing reads, while a few, say 2, threads did the writes. One feature that's useful to demonstrate is that readers are not blocked by writers

@quietlychris
Copy link
Contributor Author

Sorry for the delay! I've tried updating this to have 8 readers and writers; the println! statements seems a little messy, but not sure if there's a better way to demonstrate the behavior.

@cberner cberner merged commit e326362 into cberner:master Feb 3, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants