[Previous] [Contents] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

pmd_lock_shared()

Acquire a shared lock on a pmd_attr_t structure

Synopsis:

#include <sys/pm.h>

int pmd_lock_shared(pmd_attr_t *pmd); 

Arguments:

pmd
Pointer to the pmd_attr_t structure to be locked.

Library:

libpm

Description:

The pmd_lock_shared() function acquires a shared lock on the pmd_attr_t structure. Multiple threads can hold this lock and blocks any thread attempting a pmd_lock_exclusive() until all shared locks are released.

If the lock is currently held exclusively, pmd_lock_shared() blocks until the exclusive lock is released.

The lock implements an "exclusive preference" so that any thread waiting for an exclusive lock prevents new shared locks being acquired if the lock is currently held shared. This allows the exclusive lock to be acquired as soon as all current shared locks are released.

Returns:

EOK
Success.
Error code from pthread_sleepon_lock(), pthread_sleepon_unlock() or pthread_sleepon_wait().
Otherwise.

Examples:

For more information, see the Device Driver chapter.

Classification:

Neutrino

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pmd_unlock_shared(), pmd_lock_exclusive(), pthread_lock_upgrade(), pthread_sleepon_lock(), pthread_sleepon_unlock(), pthread_sleepon_wait()


[Previous] [Contents] [Next]