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


tis_mutex_trylock

Attempts to lock a mutex.

Syntax

tis_mutex_trylock(
                  mutex );
 


Argument Data Type Access

mutex opaque pthread_mutex_t read


C Binding

#include 

int tis_mutex_trylock ( pthread_mutex_t *mutex);

Arguments

mutex
Address of the mutex (passed by reference) to be locked.

Description

This routine attempts to lock a mutex. When this routine is called, an attempt is made to immediately lock the mutex. If the mutex is successfully locked, 0 is returned. If the specified mutex is locked when this routine is called, the caller does not wait for the mutex to become available. EBUSY is returned and the thread does not wait to acquire the lock.

Return Values

If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Return        Description

0 Successful completion. [EBUSY] The mutex is already locked; therefore, it was not acquired. [EINVAL] The value specified by mutex is invalid.


Associated Routines

   tis_mutex_destroy
   tis_mutex_init
   tis_mutex_lock
   tis_mutex_unlock



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