[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


cma_mutex_try_lock

Locks a mutex. If the mutex is already locked, the calling thread does not wait for the mutex to become available.

Syntax

cma_mutex_try_lock(
                    mutex);
 


Argument Data Type Access

mutex opaque cma_t_mutex read


C Binding

#include 

cma_t_boolean cma_mutex_try_lock ( cma_t_mutex *mutex);

Arguments

mutex
Handle of the mutex to be locked.

Description

This routine locks a mutex and its behavior varies based on the kind of mutex. If the specified mutex is locked when a thread calls this routine, the calling thread does not wait for the mutex to become available.

When a thread calls this routine, an attempt is made to immediately lock the mutex. If the mutex is successfully locked, the Boolean value cma_c_true is returned. The current thread is then the mutex's current owner.

If the mutex is already locked when this routine is called (even if it was previously locked by the current thread), the Boolean value cma_c_false is returned and the thread does not wait to acquire the lock.

Exceptions

cma_e_existence
cma_e_use_error



[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]