[ntp:questions] new driver development

Richard B. Gilbert rgilbert88 at comcast.net
Sat Apr 9 20:43:59 UTC 2011


On 4/9/2011 12:55 PM, Hal Murray wrote:
> What happens to a mutex in shared memory if all the processes using
> that memory go away?  Does that shared memory stay around, or would
> the mutex have to be reinitialized if one of the programs using it
> gets restarted?
>
> Is there any way to test to see if a mutex has been initialized?

You initialize your mutex BEFORE it is needed.  After that, processes 
that need the mutex will claim it if available, and queue up for it if 
it not.

Think of it as a stall in a men's room or ladies room.  If you need to 
use it, you look for an unlatched door, if the door is latched you wait 
until the occupant flushes and leaves.






More information about the questions mailing list