[Previous] [Contents] [Next]

pthread_spin_trylock()

Try locking a thread spinlock

Synopsis:

#include <pthread.h>

int pthread_spin_trylock( 
       pthread_spinlock_t * spinner );

Library:

libc

Description:

The pthread_spin_trylock() function attempts to lock the thread spinlock specified by spinner. It returns immediately if spinner can't be locked.

If a thread attempts to lock a spinlock that it's already locked via pthread_spin_lock() or pthread_spin_trylock() it deadlocks.

Returns:

EOK
Success.
EAGAIN
Insufficient resources available to lock spinner.
EBUSY
The thread spinlock spinner is already locked by another thread.
EINVAL
Invalid pthread_spinlock_t object spinner.

Classification:

POSIX 1003.1j (draft)

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pthread_spin_destroy(), pthread_spin_init(), pthread_spin_lock(), pthread_spin_unlock()


[Previous] [Contents] [Next]