smol-rs / concurrent-queue

Concurrent multi-producer multi-consumer queue
Apache License 2.0
254 stars 22 forks source link

Make concurrent-queue loom-aware #5

Closed Restioson closed 2 years ago

Restioson commented 4 years ago

This PR implements loom-awareness for concurrent-queue. Particularly, downstream users can pass --cfg loom to rustc via RUSTFLAGS in order to then run loom tests for their crates using concurrent-queue, and have loom be able to test/track the concurrent-queue parts too.

I'm not sure how this interacts with the CI. Ideally, the checking should be run with both loom on and off, the normal tests with loom off, and any loom tests with loom on. In order to enable loom, RUSTFLAGS must be set to have --cfg loom. I haven't written any loom tests for concurrent-queue in this PR yet, though that could come in subsequent work.

Restioson commented 4 years ago

Ok, it appears that this isn't working yet - not really sure how it didn't trigger in my initial cargo tests - so I will try and fix it.

Restioson commented 4 years ago

Okay, I have fixed it. The last unresolved issue is around CI.

Restioson commented 4 years ago

There are some workarounds included here which may be possible to get rid of if changes are made in loom (e.g atomic and cell get mut rather than with mut) , so maybe you'd want to wait to see how that pans out?

Restioson commented 4 years ago

I've been investigating as to why my crate fails under loom, and this could be related to loom not supporting atomic SeqCst fences yet. If this is the case, then this PR may have to be closed pending loom being able to support that. That being said, I'm not sure that is the reason, so it will need some further investigation.

notgull commented 2 years ago

Obsoleted by #27