NAME

shared_mutex -- POSIX mutex variable that is shared among multiple processes

SYNOPSIS

   #include <afblib/shared_mutex.h>

   bool shared_mutex_create(shared_mutex* mutex);
   bool shared_mutex_free(shared_mutex* mutex);

   bool shared_mutex_lock(shared_mutex* mutex);
   bool shared_mutex_unlock(shared_mutex* mutex);

DESCRIPTION

A shared mutex variable is one that can be used in a memory segment that is shared among multiple processes. By default, POSIX mutex variables must not be shared among multiple processes. Instead the special attribute PTHREAD_PROCESS_SHARED has to be set to support this setup.

shared_mutex_create and shared_mutex_free must be called by one process only, usually the process that configures the shared memory segment. The other processes must not invoke any of the other operations as long as the mutex variable has not been created properly with shared_mutex_create and the mutex variable must no longer be used once it has been free'd using shared_mutex_free.

AUTHOR

Andreas F. Borchert