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] - Rev 441

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

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

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

powered by: WebSVN 2.1.0

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