If I have two processes accessing a given registry key (e.g. HKLM), should I wrap the the logic in a mutex?
If I have two processes accessing a given registry key (e.g. HKLM ), should
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The registry will make sure the actions are atomic, so you don’t have to synchronize it yourself.
However, if you have multiple processes / threads accessing the registry at the same time, it doesn’t make any guarantees about which happens first. Only that you won’t get garbled data.
Edit: Further reading, see The inability to lock someone out of the registry is a feature, not a bug.