Question

A program creates a mutex as part of its start-up. what is the lifetime of the mutex, how long does it exist? when it is destroyed?

Since mutex can be used globally by other process requesting handle for it, if the program created the mutex is terminated whether the mutex will not be terminated?

How long the mutex stay in the system? whether it survives till reboot?

i am using process explorer to see the mutex in the system. Is there any other way to find mutex in the system?

i have already checked the msdn links not much information there, is there any other resource on internet to check on mutex and its lifetime?

Was it helpful?

Solution

The mutex lives as long as there exist handles to it. When the last handle to the mutex is closed, the mutex dies. In that regard it is no different from any other object that can be shared across multiple processes.

The documentation for CreateMutex says it like this:

The mutex object is destroyed when its last handle has been closed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top