wiki:pthread_spin_trylock

Version 3 (modified by Ghassan Almaless, 17 years ago) (diff)

--

Nom

pthread_spin_lock - Verrouille un verrou à une attente active (objet de synchronisation temps-réal).

Synopsis

#include <pthread.h>
int pthread_spin_lock(pthread_spinlock_t *lock);

Description

Cette fonction devra verrouiller le verrou à une attente active référencé par lock si ce verrou n'a pas été déjà verrouillé par un thread.

Le thread appelant devra acquérir le verrou lock si n'est pas verrouillé par un autre thread, dans le cas contraire, l'appel devra échouer

Le résultat est indéfini si le verrou lock est déjà verrouillé par le thread appelant.

Le résultat est indéfini si le verrou référencé par lock n'a pas été initialisé auparavant par l'appel à la fonction pthread_spin_init

Une verion bloquante de cette fonction est pthread_spin_lock

Valeur Renvoyée

En cas de succès, pthread_spin_trylock() renvoie la valeur 0. En cas d'erreur, un code d'erreur est renvoyé.

Erreurs

La fonction pthread_spin_trylock() renvoie l'un des codes d'erreur suivants en cas de problème:

EINVAL
La valeur de lock est nulle ou ne réfère pas à un verrou déjà initialisé.
EDEADLK
L'implémentation a détecté que le thread appelant détient encore le verrou au moment de l'appel
EBUSY
le verrou référencé par lock est déjà détenu par un autre thread

Source

Copyright
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Traduction

Ghassan Almaless <Ghassan.Almalass@…>, <ghassan.almaless@…>, 2007

Voir Aussi

pthread_spin_init, pthread_spin_destroy, pthread_spin_lock, pthread_spin_unlock.