# OS_TryLockMutex[R|W]

## Syntax

  `#include <nitro/os.h>`
  `BOOL OS_TryLockMutexR( OSMutex* mutex );`
  `BOOL OS_TryLockMutexW( OSMutex* mutex );`

## Arguments

`mutex` | Pointer to the `OSMutex` structure

## Return Values

Returns TRUE when `mutex` is locked. Otherwise returns FALSE.

## Description

The calling thread attempts to lock `mutex`.

`mutex` is the pointer to the `OSMutex` structure to be changed.

The `OS_TryLockMutexR` function tries to `read lock` the mutex. The `OS_TryLockMutexW` function tries to `write lock` the mutex. To read how these two functions differ, see the `OS_LockMutexR/OS_LockMutexW` functions.

If the mutex cannot be locked, the function returns `FALSE`. If the mutex can be locked, the `OS_TryLockMutexR` function conforms to the process of the `OS_LockMutexR` function, and the `OS_TryLockMutexW` function conforms to the process of the `OS_LockMutexW` function.

## See Also

`OS_InitMutex
OS_LockMutex
OS_UnlockMutex
OS_LockMutexR
OS_LockMutexW
OS_UnlocMutexR
OS_UnlocMutexW
OS_LockMutexFromRToW
OS_LockMutexFromWToR
OS_TryLockMutexFromRToW
OS_TryLockMutexFromWToR`

## Revision History

2008/12/16 Initial version.

CONFIDENTIAL