MultiThreading - SyncObject - CMutex [英] MultiThreading - SyncObject - CMutex
本文介绍了MultiThreading - SyncObject - CMutex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Mutex是否允许在不同的流程中访问整个流程?
如果是,请提供一些实时示例。
问候
Ranjith
Hi,
Mutex will allow to access the across the process means in different process?
If Yes please provide some realtime example.
Regards
Ranjith
推荐答案
不,互斥锁会< b>阻止不同的进程通过同步来搞砸访问。
是的,互斥锁可以由两个或多个不同进程的线程共享,而不是只有同一进程的线程。
如果相同进程的线程使用互斥锁,则不必命名,但不同的进程需要名称。这是因为所有过程都是完全孤立的;并且诸如指向诸如互斥体之类的对象的指针的存储器位置可以在每个存储器空间中具有形式上相同的地址但指向不同的物理位置。这样,没有名称,就不可能共享任何对象。因此,每个进程都有自己的指向互斥锁的指针,互斥锁实际上应该是一个共享对象。
请参阅:
http://en.wikipedia.org/wiki/Mutex [ ^ ],
http://msdn.microsoft.com/en-us/library/tt45160e%28v=vs.80%29.aspx [ ^ ]。< br $>
-SA
No, a mutex will prevent different process to screw up access, through synchronization.
Yes, a mutex can be shared by two or more threads of different processes, not only the threads of the same process.
If a mutex is used by threads of the same processes, it does not have to be named, but different processes requires the name. This is because all processes are well isolated; and the memory locations, such as pointers to an object like a mutex may have formally identical address in each memory space but point to different physical location. This way, without a name, it would be impossible to share any object. So, each process gets its own pointer to a mutex, which physically should be one shared object.
Please see:
http://en.wikipedia.org/wiki/Mutex[^],
http://msdn.microsoft.com/en-us/library/tt45160e%28v=vs.80%29.aspx[^].
—SA
这篇关于MultiThreading - SyncObject - CMutex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文