*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> pthread_mutex_trylock (3)              
Title
Content
Arch
Section
 

pthread_mutex_trylock(3)

Contents


NAME    [Toc]    [Back]

       pthread_mutex_trylock  -  Attempts  to  lock the specified
       mutex, without waiting if already locked

SYNOPSIS    [Toc]    [Back]

       #include <pthread.h>

       int pthread_mutex_trylock(
               pthread_mutex_t *mutex );

LIBRARY    [Toc]    [Back]

       DECthreads POSIX 1003.1c Library (libpthread.so)

STANDARDS    [Toc]    [Back]

       Interfaces documented on this reference  page  conform  to
       industry standards as follows:

       IEEE  Std  1003.1c-1995,  POSIX System Application Program
       Interface

PARAMETERS    [Toc]    [Back]

       Mutex to be locked.

DESCRIPTION    [Toc]    [Back]

       This routine attempts to lock the mutex specified  in  the
       mutex  argument.  When  a  thread  calls  this routine, an
       attempt is made to immediately  lock  the  mutex.  If  the
       mutex  is  successfully  locked, this routine returns zero
       (0) and the calling thread  becomes  the  mutex's  current
       owner.  If  the  specified  mutex  is locked when a thread
       calls this routine, the calling thread does not  wait  for
       the mutex to become available.

       The  behavior of this routine is as follows: For a normal,
       default, or errorcheck mutex: if the mutex  is  locked  by
       any  thread  (including the calling thread) when this routine
 is called, this routine returns [EBUSY] and the calling
  thread does not wait to acquire the lock.  For a normal
 or errorcheck mutex: if the mutex is not  owned,  this
       routine  returns  zero (0) and the mutex becomes locked by
       the calling thread.  For a recursive mutex: if  the  mutex
       is  owned by the calling thread, this routine returns zero
       (0) and the mutex lock count is incremented.  (To unlock a
       recursive  mutex,  each  call  to pthread_mutex_trylock(3)
       must be matched by a call to pthread_mutex_unlock(3).)

       Use the pthread_mutexattr_settype(3) routine  to  set  the
       mutex  type  attribute  (normal,  default,  recursive,  or
       errorcheck).

RETURN VALUES    [Toc]    [Back]

       If an error condition  occurs,  this  routine  returns  an
       integer  value  indicating  the  type  of  error. Possible
       return values are as follows: Successful completion.   The
       mutex  is  already locked; therefore, it was not acquired.
       The value specified by mutex is not a valid mutex.






ERRORS    [Toc]    [Back]

       None

SEE ALSO    [Toc]    [Back]

      
      
       Functions:                   pthread_mutexattr_settype(3),
       pthread_mutex_destroy(3),           pthread_mutex_init(3),
       pthread_mutex_lock(3), pthread_mutex_unlock(3)

       Manuals: Guide to DECthreads and Programmer's Guide



                                         pthread_mutex_trylock(3)
[ Back ]
 Similar pages
Name OS Title
pthread_rwlock_tryrdlock Tru64 Attempts to acquire a readwrite lock for read access without waiting
pthread_rwlock_trywrlock Tru64 Attempts to acquire a readwrite lock for write access without waiting
tis_mutex_trylock Tru64 Attempts to lock the specified mutex
tis_read_trylock Tru64 Attempts to acquire a read-write lock for read access and does not wait if the lock cannot be immedi...
pthread_mutex_lock OpenBSD lock a mutex
pthread_mutex_lock FreeBSD lock a mutex
pthread_mutex_trylock OpenBSD attempt to lock a mutex without blocking
pthread_mutex_trylock FreeBSD attempt to lock a mutex without blocking
pthread_mutexattr_gettype Tru64 Obtains the mutex type attribute in the specified mutex attributes object
pthread_mutexattr_settype Tru64 Specifies the mutex type attribute that is used when a mutex is created
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service