let guard = HazardPointer::new();
let ptr1 = guard.protect_ptr(atomic1);
let ptr2 = guard.protect_ptr(atomic2); // ①
guard.reset_protection(); // ②
What does ① do? Does it drop protection for ptr1 and begin protecting ptr2? Or does it fail every time because reset_protection wasn't called in between? I think the documentation doesn't currently explicitly state this.
Similarly, I can imagine multiple things ② might do.
The former — protecting a new pointer stops protecting the old pointer. A given hazard pointer can only protect at most one pointer at the time. I totally agree this should be explicit in the documentation!
What does ① do? Does it drop protection for
ptr1
and begin protectingptr2
? Or does it fail every time becausereset_protection
wasn't called in between? I think the documentation doesn't currently explicitly state this.Similarly, I can imagine multiple things ② might do.