1pthread_spin_lock(3C)    Standard C Library Functions    pthread_spin_lock(3C)
2
3
4

NAME

6       pthread_spin_lock, pthread_spin_trylock - lock a spin lock object
7

SYNOPSIS

9       cc -mt [ flag... ] file... [ library... ]
10       #include <pthread.h>
11
12       int pthread_spin_lock(pthread_spinlock_t *lock);
13
14
15       #include <pthread.h>
16
17       int pthread_spin_trylock(pthread_spinlock_t *lock);
18
19

DESCRIPTION

21       The  pthread_spin_lock()  function  locks  the  spin lock referenced by
22       lock. The calling thread acquires the lock if it is not held by another
23       thread.  Otherwise, the thread spins (that is, does not return from the
24       pthread_spin_lock call()) until the lock becomes available. The results
25       are undefined if the calling thread holds the lock at the time the call
26       is made.
27
28
29       The pthread_spin_trylock() function locks the spin lock  referenced  by
30       lock if it is not held by any thread. Otherwise, the function fails.
31
32
33       The  results  are undefined if either of these functions is called with
34       an uninitialized spin lock.
35

RETURN VALUES

37       Upon successful completion, these functions returns  0.  Otherwise,  an
38       error number is returned to indicate the error.
39

ERRORS

41       The pthread_spin_trylock() function will fail if:
42
43       EBUSY    A thread currently holds the lock.
44
45
46
47       These functions may fail if:
48
49       EINVAL    The  value specified by lock does not refer to an initialized
50                 spin lock object.
51
52
53
54       The pthread_spin_lock() function may fail if:
55
56       EDEADLK    The calling thread already holds the lock.
57
58

ATTRIBUTES

60       See attributes(5) for descriptions of the following attributes:
61
62
63
64
65       ┌─────────────────────────────┬─────────────────────────────┐
66       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
67       ├─────────────────────────────┼─────────────────────────────┤
68       │Interface Stability          │Standard                     │
69       ├─────────────────────────────┼─────────────────────────────┤
70       │MT-Level                     │MT-Safe                      │
71       └─────────────────────────────┴─────────────────────────────┘
72

SEE ALSO

74       pthread_spin_destroy(3C), pthread_spin_unlock(3C), attributes(5), stan‐
75       dards(5)
76
77
78
79SunOS 5.11                        30 Jan 2004            pthread_spin_lock(3C)
Impressum