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

NAME

6       pthread_cond_signal,  pthread_cond_broadcast  -  signal  or broadcast a
7       condition
8

SYNOPSIS

10       cc -mt [ flag... ] file... -lpthread [ library... ]
11       #include <pthread.h>
12
13       int pthread_cond_signal(pthread_cond_t *cond);
14
15
16       int pthread_cond_broadcast(pthread_cond_t *cond);
17
18

DESCRIPTION

20       These two functions are used to unblock threads blocked on a  condition
21       variable.
22
23
24       The  pthread_cond_signal()  call  unblocks  at least one of the threads
25       that are blocked on the  specified  condition  variable  cond  (if  any
26       threads are blocked on cond).
27
28
29       The   pthread_cond_broadcast()  call  unblocks  all  threads  currently
30       blocked on the specified condition variable cond.
31
32
33       If more than one thread is blocked on a condition variable, the  sched‐
34       uling  policy determines the order in which threads are unblocked. When
35       each thread  unblocked  as  a  result  of  a  pthread_cond_signal()  or
36       pthread_cond_broadcast()  returns  from its call to pthread_cond_wait()
37       or pthread_cond_timedwait(), the thread owns the mutex  with  which  it
38       called  pthread_cond_wait()  or pthread_cond_timedwait(). The thread(s)
39       that are unblocked contend for the mutex according  to  the  scheduling
40       policy (if applicable), and as if each had called pthread_mutex_lock().
41
42
43       The  pthread_cond_signal() or pthread_cond_broadcast() functions may be
44       called by a thread whether or not it  currently  owns  the  mutex  that
45       threads  calling  pthread_cond_wait()  or pthread_cond_timedwait() have
46       associated with the condition variable during their waits; however,  if
47       predictable  scheduling behavior is required, then that mutex is locked
48       by the  thread  calling  pthread_cond_signal()  or  pthread_cond_broad‐
49       cast().
50
51
52       The  pthread_cond_signal()  and pthread_cond_broadcast() functions have
53       no effect if there are no threads currently blocked on cond.
54

RETURN VALUES

56       If successful, the pthread_cond_signal()  and  pthread_cond_broadcast()
57       functions return  0. Otherwise, an error number is returned to indicate
58       the error.
59

ERRORS

61       The  pthread_cond_signal() and  pthread_cond_broadcast()  function  may
62       fail if:
63
64       EINVAL    The  value  cond  does  not refer to an initialized condition
65                 variable.
66
67

ATTRIBUTES

69       See attributes(5) for descriptions of the following attributes:
70
71
72
73
74       ┌─────────────────────────────┬─────────────────────────────┐
75       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
76       ├─────────────────────────────┼─────────────────────────────┤
77       │Interface Stability          │Standard                     │
78       ├─────────────────────────────┼─────────────────────────────┤
79       │MT-Level                     │MT-Safe                      │
80       └─────────────────────────────┴─────────────────────────────┘
81

SEE ALSO

83       pthread_cond_init(3C),    pthread_cond_wait(3C),    pthread_cond_timed‐
84       wait(3C), attributes(5), condition(5), standards(5)
85
86
87
88SunOS 5.11                        23 Mar 2005          pthread_cond_signal(3C)
Impressum