[Previous] [Contents] [Next]

pthread_spin_lock()

Lock a thread spinlock

Synopsis:

#include <pthread.h>

int pthread_spin_lock( pthread_spinlock_t * spinner );

Library:

libc

Description:

The pthread_spin_lock() function locks the thread spinlock specified by spinner. If spinner isn't immediately available, pthread_spin_lock() spins until spinner can be locked.

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

Returns:

EOK
Success.
EAGAIN
Insufficient resources available to lock spinner.
EDEADLK
The calling thread already holds spinners lock.
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_trylock(), pthread_spin_unlock()


[Previous] [Contents] [Next]