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


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.

Comments (4)
  1. Michael says:

    I am just curious: Your recent posts keep appearing and disappearing, what is the cause of this?

  2. Joshua says:

    I submit it’s manifestly obvious. The load-balanced servers are having db synchronization trouble.

    1. cheong00 says:

      Agreed. If you open the page and set it to idle like 5 minutes before posting, it seems the load balancer can redirect you to another server so you’ll have posting errors.

      The same happens in MSDN forums too, which makes it quite annoying when writing long replies.

      1. Yukkuri says:

        I always write long forum replies in a text editor and then copy paste. Problems like this are all too common…

Comments are closed.

Skip to main content