OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [libc-thread-safety.html] - Blame information for rev 594

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 unneback
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2
<!-- This material may be distributed only subject to the terms      -->
3
<!-- and conditions set forth in the Open Publication License, v1.0  -->
4
<!-- or later (the latest version is presently available at          -->
5
<!-- http://www.opencontent.org/openpub/).                           -->
6
<!-- Distribution of the work or derivative of the work in any       -->
7
<!-- standard (paper) book form is prohibited unless prior           -->
8
<!-- permission is obtained from the copyright holder.               -->
9
<HTML
10
><HEAD
11
><TITLE
12
>Thread safety</TITLE
13
><meta name="MSSmartTagsPreventParsing" content="TRUE">
14
<META
15
NAME="GENERATOR"
16
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17
"><LINK
18
REL="HOME"
19
TITLE="eCos Reference Manual"
20
HREF="ecos-ref.html"><LINK
21
REL="UP"
22
TITLE="C and math library overview"
23
HREF="c-and-math-library-overview.html"><LINK
24
REL="PREVIOUS"
25
TITLE="Some implementation details"
26
HREF="libc-implementation-details.html"><LINK
27
REL="NEXT"
28
TITLE="C library startup"
29
HREF="c-library-startup.html"></HEAD
30
><BODY
31
CLASS="SECT1"
32
BGCOLOR="#FFFFFF"
33
TEXT="#000000"
34
LINK="#0000FF"
35
VLINK="#840084"
36
ALINK="#0000FF"
37
><DIV
38
CLASS="NAVHEADER"
39
><TABLE
40
SUMMARY="Header navigation table"
41
WIDTH="100%"
42
BORDER="0"
43
CELLPADDING="0"
44
CELLSPACING="0"
45
><TR
46
><TH
47
COLSPAN="3"
48
ALIGN="center"
49
>eCos Reference Manual</TH
50
></TR
51
><TR
52
><TD
53
WIDTH="10%"
54
ALIGN="left"
55
VALIGN="bottom"
56
><A
57
HREF="libc-implementation-details.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
>Chapter 13. C and math library overview</TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="c-library-startup.html"
72
ACCESSKEY="N"
73
>Next</A
74
></TD
75
></TR
76
></TABLE
77
><HR
78
ALIGN="LEFT"
79
WIDTH="100%"></DIV
80
><DIV
81
CLASS="SECT1"
82
><H1
83
CLASS="SECT1"
84
><A
85
NAME="LIBC-THREAD-SAFETY">Thread safety</H1
86
><P
87
>The ISO C library has configuration options that control thread
88
safety, i.e. working behavior if multiple threads call the same
89
function at the same time.</P
90
><P
91
>The following functionality has to be configured correctly,
92
or used carefully in a multi-threaded environment:</P
93
><P
94
></P
95
><UL
96
><LI
97
><P
98
><TT
99
CLASS="FUNCTION"
100
>mblen()</TT
101
></P
102
></LI
103
><LI
104
><P
105
><TT
106
CLASS="FUNCTION"
107
>mbtowc()</TT
108
></P
109
></LI
110
><LI
111
><P
112
><TT
113
CLASS="FUNCTION"
114
>wctomb()</TT
115
></P
116
></LI
117
><LI
118
><P
119
><TT
120
CLASS="FUNCTION"
121
>printf()</TT
122
>
123
 (and all standard I/O functions except for
124
<TT
125
CLASS="FUNCTION"
126
>sprintf()</TT
127
>
128
 and
129
<TT
130
CLASS="FUNCTION"
131
>sscanf()</TT
132
></P
133
></LI
134
><LI
135
><P
136
><TT
137
CLASS="FUNCTION"
138
>strtok()</TT
139
></P
140
></LI
141
><LI
142
><P
143
><TT
144
CLASS="FUNCTION"
145
>rand()</TT
146
>
147
 and
148
<TT
149
CLASS="FUNCTION"
150
>srand()</TT
151
></P
152
></LI
153
><LI
154
><P
155
><TT
156
CLASS="FUNCTION"
157
>signal()</TT
158
>
159
 and
160
<TT
161
CLASS="FUNCTION"
162
>raise()</TT
163
></P
164
></LI
165
><LI
166
><P
167
><TT
168
CLASS="FUNCTION"
169
>asctime()</TT
170
>
171
,
172
<TT
173
CLASS="FUNCTION"
174
>ctime()</TT
175
>
176
,
177
<TT
178
CLASS="FUNCTION"
179
>gmtime()</TT
180
>
181
, and
182
<TT
183
CLASS="FUNCTION"
184
>localtime()</TT
185
></P
186
></LI
187
><LI
188
><P
189
>the
190
<TT
191
CLASS="FUNCTION"
192
>errno</TT
193
>
194
 variable</P
195
></LI
196
><LI
197
><P
198
>the
199
<TT
200
CLASS="FUNCTION"
201
>environ</TT
202
>
203
 variable</P
204
></LI
205
><LI
206
><P
207
>date and time settings</P
208
></LI
209
></UL
210
><P
211
>In some cases, to make <SPAN
212
CLASS="emphasis"
213
><I
214
CLASS="EMPHASIS"
215
>eCos</I
216
></SPAN
217
> development
218
easier, functions are provided (as specified by POSIX 1003.1) that define
219
re-entrant alternatives, i.e. <TT
220
CLASS="FUNCTION"
221
>rand_r()</TT
222
>, <TT
223
CLASS="FUNCTION"
224
>strtok_r()</TT
225
>, <TT
226
CLASS="FUNCTION"
227
>asctime_r()</TT
228
>, <TT
229
CLASS="FUNCTION"
230
>ctime_r()</TT
231
>, <TT
232
CLASS="FUNCTION"
233
>gmtime_r()</TT
234
>,
235
and <TT
236
CLASS="FUNCTION"
237
>localtime_r()</TT
238
>. In other cases,
239
configuration options are provided that control either locking of functions
240
or their shared data, such as with standard I/O streams,
241
or by using per-thread data, such as with the <TT
242
CLASS="FUNCTION"
243
>errno</TT
244
> variable.</P
245
><P
246
>In some other cases, like the setting of date and time, no
247
re-entrant or thread-safe alternative or configuration is provided
248
as it is simply not a worthwhile addition (date and time should
249
rarely need to be set.)</P
250
></DIV
251
><DIV
252
CLASS="NAVFOOTER"
253
><HR
254
ALIGN="LEFT"
255
WIDTH="100%"><TABLE
256
SUMMARY="Footer navigation table"
257
WIDTH="100%"
258
BORDER="0"
259
CELLPADDING="0"
260
CELLSPACING="0"
261
><TR
262
><TD
263
WIDTH="33%"
264
ALIGN="left"
265
VALIGN="top"
266
><A
267
HREF="libc-implementation-details.html"
268
ACCESSKEY="P"
269
>Prev</A
270
></TD
271
><TD
272
WIDTH="34%"
273
ALIGN="center"
274
VALIGN="top"
275
><A
276
HREF="ecos-ref.html"
277
ACCESSKEY="H"
278
>Home</A
279
></TD
280
><TD
281
WIDTH="33%"
282
ALIGN="right"
283
VALIGN="top"
284
><A
285
HREF="c-library-startup.html"
286
ACCESSKEY="N"
287
>Next</A
288
></TD
289
></TR
290
><TR
291
><TD
292
WIDTH="33%"
293
ALIGN="left"
294
VALIGN="top"
295
>Some implementation details</TD
296
><TD
297
WIDTH="34%"
298
ALIGN="center"
299
VALIGN="top"
300
><A
301
HREF="c-and-math-library-overview.html"
302
ACCESSKEY="U"
303
>Up</A
304
></TD
305
><TD
306
WIDTH="33%"
307
ALIGN="right"
308
VALIGN="top"
309
>C library startup</TD
310
></TR
311
></TABLE
312
></DIV
313
></BODY
314
></HTML
315
>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.