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

Convert a pmd_attr_t exclusive lock to a shared lock

Synopsis:

#include <sys/pm.h>

int pmd_lock_downgrade(pmd_attr_t *pmd); 

Arguments:

pmd
Pointer to the pmd_attr_t structure.

Library:

libpm

Description:

The pmd_lock_downgrade() is used to atomically convert an exclusive lock to a shared lock.

Any threads blocked in pmd_lock_exclusive() remain blocked until the shared lock is released.

This downgrade preserves the "exclusive preference" for the lock, and unblocks only threads blocked in pmd_lock_shared() if there are no threads waiting to acquire the exclusive lock.

Returns:

EOK
Success.
Error code from pthread_sleepon_lock(), pthread_sleepon_broadcast(), and pthread_sleepon_unlock().
An error has occurred.

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_lock_upgrade(), pmd_lock_exclusive(), pmd_lock_shared(), pmd_unlock_shared(), pthread_sleepon_lock(), pthread_sleepon_unlock(), pthread_sleepon_broadcast()


[Previous] [Contents] [Next]