[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_exclusive()

Acquire an exclusive lock on a pmd_attr_t structure

Synopsis:

#include <sys/pm.h>

int pmd_lock_exclusive(pmd_attr_t *pmd); 

Arguments:

pmd
Pointer to the pmd_attr_t that is to be locked.

Library:

libpm

Description:

The pmd_lock_exclusive() function acquires an exclusive lock on the pmd_attr_t structure. This lock is required when calling pmd->setpower() or pmd_confirm() to protect access to the power mode status.

If the lock is already held either exclusively or shared, pmd_lock_exclusive() blocks until all locks are 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(), 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_exclusive(), pmd_lock_downgrade(), pmd_lock_shared(), pmd_attr_setpower(), pmd_confirm(), pthread_sleepon_lock(), pthread_sleepon_unlock(), pthread_sleepon_wait()


[Previous] [Contents] [Next]