What happens if I call EnumPropsEx while another thread is mutating the properties?

Raymond Chen

Raymond

Following up on the question Are SetProp and RemoveProp thread-safe?, you might wonder what happens if you call Enum­Props­Ex while another thread is mutating the properties?

The answer is similar to what you get if you call Find­First­File / Find­Next­File while somebody else is creating or deleting files.

  • If a property is created after the enumeration starts, then it is unspecified whether it will be reported by Enum­Props­Ex.
  • If a property is deleted after the enumeration starts, then it is unspecified whether it will be reported by Enum­Props­Ex. Special exception: The enumeration callback is allowed to remove the property being enumerated.
  • If a property is modified after the enumeration starts, then it is unspecified whether the value reported by Enum­Props­Ex is the old value or the new value.

Hopefully, nobody is playing games with properties that are so crazy that any of these rules will actually come into play, aside from the special exception.

Raymond Chen
Raymond Chen

Follow Raymond