是Win32注册表“线程安全”? [英] Is the Win32 Registry 'thread safe'?
本文介绍了是Win32注册表“线程安全”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有两个进程访问某个特定的注册表项(关HKLM的),它是一个好主意,包装在一个互斥逻辑?
If I have two processes accessing a given registry key (off of HKLM), is it a good idea to wrap the logic in a Mutex?
推荐答案
注册表将确保动作是原子的,所以你不必自己动手同步。
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.
编辑:进一步阅读,看的无力锁定有人出来注册表是一个特性,而不是bug 。
Further reading, see The inability to lock someone out of the registry is a feature, not a bug.
这篇关于是Win32注册表“线程安全”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文