File: pthread_wakeup_np.3.html

package info (click to toggle)
rtlinux 3.1pre3-2
  • links: PTS
  • area: non-free
  • in suites: sarge, woody
  • size: 4,892 kB
  • ctags: 4,228
  • sloc: ansic: 26,204; sh: 2,069; makefile: 1,414; perl: 855; tcl: 489; asm: 380; cpp: 42
file content (169 lines) | stat: -rw-r--r-- 2,885 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<HTML
><HEAD
><TITLE
>pthread_wakeup_np</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"></HEAD
><BODY
CLASS="REFENTRY"
><H1
><A
NAME="AEN1"
>pthread_wakeup_np</A
></H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN5"
></A
><H2
>Name</H2
>pthread_wakeup_np&nbsp;--&nbsp;wake up a realtime thread.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN8"
></A
><H2
>Synopsis</H2
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="SYNOPSIS"
>       #include &#60;rtl_sched.h&#62;

       int <TT
CLASS="FUNCTION"
>pthread_wakeup_np</TT
>(pthread_t <TT
CLASS="PARAMETER"
><I
>thread</I
></TT
>);</PRE
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN12"
></A
><H2
>DESCRIPTION</H2
><P
>This function is a non-portable Realtime Linux extension.  <TT
CLASS="FUNCTION"
>pthread_wakeup_np</TT
> wakes up the realtime thread <TT
CLASS="PARAMETER"
><I
>thread</I
></TT
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN17"
></A
><H2
>RETURN VALUE</H2
><P
>Always returns 0.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN20"
></A
><H2
>ERRORS</H2
><P
>None.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN23"
></A
><H2
>NOTES</H2
><P
>This function is safe to call from interrupt handlers and threads, but
not from the Linux kernel. Calling the function will cause a thread switch if the
awakened thread is higher priority than the current thread and they are
both on the same processor. In this case, 
<TT
CLASS="FUNCTION"
>pthread_wakeup</TT
>  called 
from an interrupt handler will suspend the current thread at once.
The handler will complete when there are no more
runnable higher priority  threads.</P
><P
>To illustrate, suppose we want to have very simple interrupt handlers
(always a good idea), but we need complex processing done after each
interrupt.  We can designate a thread to do this processing and give it
the highest priority. Then the interrupt handlers may push some data into a
queue and call 
<TT
CLASS="FUNCTION"
>pthread_wakeup</TT
>, 
to wake up the thread and switch to it at once. (WARNING: Do not
leave any critical hardware handshaking until after the return from 
<TT
CLASS="FUNCTION"
>pthread_wakeup_np</TT
>, unless it is okay for the handshaking to be 
postponed until the interrupted thread is scheduled again.)</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN30"
></A
><H2
>AUTHOR</H2
><P
>Michael Barabanov and Victor Yodaiken (<A
HREF="mailto:support@fsmlabs.com"
TARGET="_top"
>support@fsmlabs.com</A
>)</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN34"
></A
><H2
>SEE ALSO</H2
><A
HREF="pthread_suspend_np.3.html"
TARGET="_top"
>pthread_suspend_np(3)</A
>, <A
HREF="pthread_make_periodic_np.3.html"
TARGET="_top"
>pthread_make_periodic_np(3)</A
>, <A
HREF="pthread_wait_np.3.html"
TARGET="_top"
>pthread_wait_np(3)</A
><P
>2001 FSMLabs Inc.</P
><P
>All rights reserved.</P
></DIV
></BODY
></HTML
>