Amanieu / parking_lot

Compact and efficient synchronization primitives for Rust. Also provides an API for creating custom synchronization primitives.
Apache License 2.0
2.7k stars 213 forks source link

Expose more methods from mapped guards #444

Open rybot666 opened 3 months ago

rybot666 commented 3 months ago

While very useful, mapped guards do not currently expose methods such as raw and force_unlock, which makes using them in certain contexts quite difficult. From what I can tell, there's no soundness reason why they haven't been exposed. Would a PR adding the same APIs to them as the other guards be accepted?

Amanieu commented 3 months ago

Yes, I would I accept a PR for these. Fundamentally these are unsafe functions so it's fine to expose them with appropriate warnings.

Earthcomputer commented 2 months ago

I also came across a situation where I needed to downgrade a write mapped guard to a read mapped guard. So there are a few APIs missing.