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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [libc-thread-safety.html] - Diff between revs 28 and 174

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 28 Rev 174
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- This material may be distributed only subject to the terms      -->
<!-- This material may be distributed only subject to the terms      -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- or later (the latest version is presently available at          -->
<!-- or later (the latest version is presently available at          -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- permission is obtained from the copyright holder.               -->
<!-- permission is obtained from the copyright holder.               -->
<HTML
<HTML
><HEAD
><HEAD
><TITLE
><TITLE
>Thread safety</TITLE
>Thread safety</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
<META
NAME="GENERATOR"
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
"><LINK
REL="HOME"
REL="HOME"
TITLE="eCos Reference Manual"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
HREF="ecos-ref.html"><LINK
REL="UP"
REL="UP"
TITLE="C and math library overview"
TITLE="C and math library overview"
HREF="c-and-math-library-overview.html"><LINK
HREF="c-and-math-library-overview.html"><LINK
REL="PREVIOUS"
REL="PREVIOUS"
TITLE="Some implementation details"
TITLE="Some implementation details"
HREF="libc-implementation-details.html"><LINK
HREF="libc-implementation-details.html"><LINK
REL="NEXT"
REL="NEXT"
TITLE="C library startup"
TITLE="C library startup"
HREF="c-library-startup.html"></HEAD
HREF="c-library-startup.html"></HEAD
><BODY
><BODY
CLASS="SECT1"
CLASS="SECT1"
BGCOLOR="#FFFFFF"
BGCOLOR="#FFFFFF"
TEXT="#000000"
TEXT="#000000"
LINK="#0000FF"
LINK="#0000FF"
VLINK="#840084"
VLINK="#840084"
ALINK="#0000FF"
ALINK="#0000FF"
><DIV
><DIV
CLASS="NAVHEADER"
CLASS="NAVHEADER"
><TABLE
><TABLE
SUMMARY="Header navigation table"
SUMMARY="Header navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TH
><TH
COLSPAN="3"
COLSPAN="3"
ALIGN="center"
ALIGN="center"
>eCos Reference Manual</TH
>eCos Reference Manual</TH
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="left"
ALIGN="left"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="libc-implementation-details.html"
HREF="libc-implementation-details.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="80%"
WIDTH="80%"
ALIGN="center"
ALIGN="center"
VALIGN="bottom"
VALIGN="bottom"
>Chapter 13. C and math library overview</TD
>Chapter 13. C and math library overview</TD
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="right"
ALIGN="right"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="c-library-startup.html"
HREF="c-library-startup.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"></DIV
WIDTH="100%"></DIV
><DIV
><DIV
CLASS="SECT1"
CLASS="SECT1"
><H1
><H1
CLASS="SECT1"
CLASS="SECT1"
><A
><A
NAME="LIBC-THREAD-SAFETY">Thread safety</H1
NAME="LIBC-THREAD-SAFETY">Thread safety</H1
><P
><P
>The ISO C library has configuration options that control thread
>The ISO C library has configuration options that control thread
safety, i.e. working behavior if multiple threads call the same
safety, i.e. working behavior if multiple threads call the same
function at the same time.</P
function at the same time.</P
><P
><P
>The following functionality has to be configured correctly,
>The following functionality has to be configured correctly,
or used carefully in a multi-threaded environment:</P
or used carefully in a multi-threaded environment:</P
><P
><P
></P
></P
><UL
><UL
><LI
><LI
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>mblen()</TT
>mblen()</TT
></P
></P
></LI
></LI
><LI
><LI
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>mbtowc()</TT
>mbtowc()</TT
></P
></P
></LI
></LI
><LI
><LI
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>wctomb()</TT
>wctomb()</TT
></P
></P
></LI
></LI
><LI
><LI
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>printf()</TT
>printf()</TT
>
>
 (and all standard I/O functions except for
 (and all standard I/O functions except for
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>sprintf()</TT
>sprintf()</TT
>
>
 and
 and
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>sscanf()</TT
>sscanf()</TT
></P
></P
></LI
></LI
><LI
><LI
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>strtok()</TT
>strtok()</TT
></P
></P
></LI
></LI
><LI
><LI
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>rand()</TT
>rand()</TT
>
>
 and
 and
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>srand()</TT
>srand()</TT
></P
></P
></LI
></LI
><LI
><LI
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>signal()</TT
>signal()</TT
>
>
 and
 and
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>raise()</TT
>raise()</TT
></P
></P
></LI
></LI
><LI
><LI
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>asctime()</TT
>asctime()</TT
>
>
,
,
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>ctime()</TT
>ctime()</TT
>
>
,
,
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>gmtime()</TT
>gmtime()</TT
>
>
, and
, and
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>localtime()</TT
>localtime()</TT
></P
></P
></LI
></LI
><LI
><LI
><P
><P
>the
>the
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>errno</TT
>errno</TT
>
>
 variable</P
 variable</P
></LI
></LI
><LI
><LI
><P
><P
>the
>the
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>environ</TT
>environ</TT
>
>
 variable</P
 variable</P
></LI
></LI
><LI
><LI
><P
><P
>date and time settings</P
>date and time settings</P
></LI
></LI
></UL
></UL
><P
><P
>In some cases, to make <SPAN
>In some cases, to make <SPAN
CLASS="emphasis"
CLASS="emphasis"
><I
><I
CLASS="EMPHASIS"
CLASS="EMPHASIS"
>eCos</I
>eCos</I
></SPAN
></SPAN
> development
> development
easier, functions are provided (as specified by POSIX 1003.1) that define
easier, functions are provided (as specified by POSIX 1003.1) that define
re-entrant alternatives, i.e. <TT
re-entrant alternatives, i.e. <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>rand_r()</TT
>rand_r()</TT
>, <TT
>, <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>strtok_r()</TT
>strtok_r()</TT
>, <TT
>, <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>asctime_r()</TT
>asctime_r()</TT
>, <TT
>, <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>ctime_r()</TT
>ctime_r()</TT
>, <TT
>, <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>gmtime_r()</TT
>gmtime_r()</TT
>,
>,
and <TT
and <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>localtime_r()</TT
>localtime_r()</TT
>. In other cases,
>. In other cases,
configuration options are provided that control either locking of functions
configuration options are provided that control either locking of functions
or their shared data, such as with standard I/O streams,
or their shared data, such as with standard I/O streams,
or by using per-thread data, such as with the <TT
or by using per-thread data, such as with the <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>errno</TT
>errno</TT
> variable.</P
> variable.</P
><P
><P
>In some other cases, like the setting of date and time, no
>In some other cases, like the setting of date and time, no
re-entrant or thread-safe alternative or configuration is provided
re-entrant or thread-safe alternative or configuration is provided
as it is simply not a worthwhile addition (date and time should
as it is simply not a worthwhile addition (date and time should
rarely need to be set.)</P
rarely need to be set.)</P
></DIV
></DIV
><DIV
><DIV
CLASS="NAVFOOTER"
CLASS="NAVFOOTER"
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
SUMMARY="Footer navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="libc-implementation-details.html"
HREF="libc-implementation-details.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="ecos-ref.html"
HREF="ecos-ref.html"
ACCESSKEY="H"
ACCESSKEY="H"
>Home</A
>Home</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="c-library-startup.html"
HREF="c-library-startup.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
>Some implementation details</TD
>Some implementation details</TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="c-and-math-library-overview.html"
HREF="c-and-math-library-overview.html"
ACCESSKEY="U"
ACCESSKEY="U"
>Up</A
>Up</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
>C library startup</TD
>C library startup</TD
></TR
></TR
></TABLE
></TABLE
></DIV
></DIV
></BODY
></BODY
></HTML
></HTML
 
 

powered by: WebSVN 2.1.0

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