pthread_spin_lock(), pthread_spin_trylock()

lock a spin lock object 

Advanced Realtime


SYNOPSIS

#include <pthread.h>

int pthread_spin_lock(pthread_spinlock_t *lock);

int pthread_spin_trylock(pthread_spinlock_t *lock);


DESCRIPTION

The pthread_spin_lock() function locks the spin lock pointed to by the lock argument. The calling thread shall acquire the lock if it is not held by another thread. Otherwise, the thread shall spin (that is, shall not return from the pthread_spin_lock() call) until the lock becomes available.

The pthread_spin_trylock() function locks the spin lock pointed to by the lock argument if it is not held by any thread. Otherwise, the function fails.


PARAMETERS

lock 

Points to a spin lock.


RETURN VALUES

On success, these functions return 0. On failure, they return one of the following error values:

EBUSY 

A thread currently holds the lock.

EDEADLK 

The calling thread already holds the lock.

EINVAL 

The value pointed to by lock does not refer to an initialized spin lock object.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_spin_destroy(), pthread_spin_unlock()


PTC MKS Toolkit 10.4 Documentation Build 39.