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

Are concurrent read/writes to UnsafeCell possible? #375

Open
LtdJorge opened this issue Feb 10, 2025 · 1 comment
Open

Are concurrent read/writes to UnsafeCell possible? #375

LtdJorge opened this issue Feb 10, 2025 · 1 comment

Comments

@LtdJorge
Copy link

I'm implementing a SeqLock and the underlying data is behind an UnsafeCell. Concurrent readers with a single writer are required, since the readers will check on an atomic value after reading to see if the data was written to by the reader while they were reading, and discard the data in that case.

There can only be one writer though, multiple concurrent writers should still fail the test. However, for now I'm having to use a standard UnsafeCell because this use case is not supported in Loom. Would something like this be possible to implement in Loom?

@mox692
Copy link
Member

mox692 commented Feb 12, 2025

I don't think there's a way to do that. You'll need to avoid data races explicitly.

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