VMS Help  —  POSIX Threads, TIS routines, tis_read_trylock
    Attempts to acquire a read-write lock for read access. Does not
    wait if the lock cannot be immediately granted.

1  –  C Binding

    #include <tis.h>

    int
    tis_read_trylock (
             tis_rwlock_t    *lock);

2  –  Arguments

 lock

    Address of the read-write lock to be acquired.

3  –  Description

    This routine attempts to acquire a read-write lock for read
    access. If the lock cannot be granted, the routine returns
    without waiting.

    When a thread calls this routine, an attempt is made to
    immediately acquire the lock for read access. If the lock is
    acquired, zero (0) is returned. If a holder of the lock for write
    access exists, [EBUSY] is returned.

    If the lock cannot be acquired for read access immediately, the
    calling program does not wait for the lock to be released.

4  –  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; the lock was acquired.
    [EBUSY]     The lock is being held for write access. The lock for
                read access was not acquired.
    [EINVAL]    The value specified by lock is not a valid read-write
                lock.

5  –  Associated Routines

       tis_read_lock()
       tis_read_unlock()
       tis_rwlock_destroy()
       tis_rwlock_init()
       tis_write_lock()
       tis_write_trylock()
       tis_write_unlock()
Close Help