⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 posix-synchronization.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
字号:
<!-- 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>Synchronization [POSIX Section 11]</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="POSIX Standard Support"HREF="posix-standard-support.html"><LINKREL="PREVIOUS"TITLE="Data Interchange Format [POSIX Section 10]"HREF="posix-data-interchange-format.html"><LINKREL="NEXT"TITLE="Memory Management [POSIX Section 12]"HREF="posix-memory-management.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="posix-data-interchange-format.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 31. POSIX Standard Support</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="posix-memory-management.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="POSIX-SYNCHRONIZATION">Synchronization &#0091;POSIX Section 11&#0093;</H1><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN13150">Functions Implemented</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SCREEN">int sem&#0095;init(sem&#0095;t &#0042;sem, int pshared, unsigned int value); int sem&#0095;destroy(sem&#0095;t &#0042;sem); int sem&#0095;wait(sem&#0095;t &#0042;sem); int sem&#0095;trywait(sem&#0095;t &#0042;sem); int sem&#0095;post(sem&#0095;t &#0042;sem);int sem&#0095;getvalue(sem&#0095;t &#0042;sem, int &#0042;sval); int pthread&#0095;mutexattr&#0095;init( pthread&#0095;mutexattr&#0095;t &#0042;attr); int pthread&#0095;mutexattr&#0095;destroy( pthread&#0095;mutexattr&#0095;t &#0042;attr); int pthread&#0095;mutex&#0095;init(pthread&#0095;mutex&#0095;t &#0042;mutex,	               const pthread&#0095;mutexattr&#0095;t &#0042;mutex&#0095;attr); int pthread&#0095;mutex&#0095;destroy(pthread&#0095;mutex&#0095;t &#0042;mutex); int pthread&#0095;mutex&#0095;lock(pthread&#0095;mutex&#0095;t &#0042;mutex); int pthread&#0095;mutex&#0095;trylock(pthread&#0095;mutex&#0095;t &#0042;mutex); int pthread&#0095;mutex&#0095;unlock(pthread&#0095;mutex&#0095;t &#0042;mutex); int pthread&#0095;condattr&#0095;init(pthread&#0095;condattr&#0095;t &#0042;attr); int pthread&#0095;condattr&#0095;destroy(pthread&#0095;condattr&#0095;t &#0042;attr); int pthread&#0095;cond&#0095;init(pthread&#0095;cond&#0095;t &#0042;cond, 	               const pthread&#0095;condattr&#0095;t &#0042;attr); int pthread&#0095;cond&#0095;destroy(pthread&#0095;cond&#0095;t &#0042;cond); int pthread&#0095;cond&#0095;signal(pthread&#0095;cond&#0095;t &#0042;cond); int pthread&#0095;cond&#0095;broadcast(pthread&#0095;cond&#0095;t &#0042;cond); int pthread&#0095;cond&#0095;wait(pthread&#0095;cond&#0095;t &#0042;cond, 	               pthread&#0095;mutex&#0095;t &#0042;mutex);int pthread&#0095;cond&#0095;timedwait(pthread&#0095;cond&#0095;t &#0042;cond,	                   pthread&#0095;mutex&#0095;t &#0042;mutex,	                   const struct timespec &#0042;abstime);</PRE></TD></TR></TABLE></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN13153">Functions Omitted</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SCREEN">sem&#0095;t &#0042;sem&#0095;open(const char &#0042;name, int oflag, ...);		&#0047;&#0047; TBA int sem&#0095;close(sem&#0095;t &#0042;sem);					&#0047;&#0047; TBA int sem&#0095;unlink(const char &#0042;name);				&#0047;&#0047; TBA int pthread&#0095;mutexattr&#0095;getpshared( const pthread&#0095;mutexattr&#0095;t &#0042;attr,	                          int &#0042;pshared );int pthread&#0095;mutexattr&#0095;setpshared( const pthread&#0095;mutexattr&#0095;t &#0042;attr,	                          int pshared );int  pthread&#0095;condattr&#0095;getpshared( const pthread&#0095;condattr&#0095;t &#0042;attr, 	                          int &#0042;pshared);int  pthread&#0095;condattr&#0095;setpshared( const pthread&#0095;condattr&#0095;t &#0042;attr,	                          int pshared);</PRE></TD></TR></TABLE></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN13156">Notes</H2><P></P><UL><LI><P>	    The presence of semaphores is controlled by the	    CYGPKG&#0095;POSIX&#0095;SEMAPHORES option. This in turn	    causes the &#0095;POSIX&#0095;SEMAPHORES feature test	    macro to be defined and the semaphore API to be made	    available.	    </P></LI><LI><P>	    The <SPANCLASS="strong"><BCLASS="EMPHASIS">pshared</B></SPAN> argument to	    <SPANCLASS="emphasis"><ICLASS="EMPHASIS">sem&#0095;init()</I></SPAN> is not implemented,	    its value is ignored.	    </P></LI><LI><P>	    Functions <SPANCLASS="emphasis"><ICLASS="EMPHASIS">sem&#0095;open()</I></SPAN>, 	    <SPANCLASS="emphasis"><ICLASS="EMPHASIS">sem&#0095;close()</I></SPAN> and	    <SPANCLASS="emphasis"><ICLASS="EMPHASIS">sem&#0095;unlink()</I></SPAN> are present but	    always return an error (ENOSYS).	    </P></LI><LI><P>	    The exact priority inversion protocols supported may be	    controlled with the	    &#0095;POSIX&#0095;THREAD&#0095;PRIO&#0095;INHERIT and	    &#0095;POSIX&#0095;THREAD&#0095;PRIO&#0095;PROTECT	    configuration options.	    </P></LI><LI><P>	    &#0123;&#0095;POSIX&#0095;THREAD&#0095;PROCESS&#0095;SHARED&#0125; is	    not defined, so the 	    <SPANCLASS="strong"><BCLASS="EMPHASIS">process-shared</B></SPAN> mutex	    and condition variable attributes are not supported, and	    neither are the functions	    <SPANCLASS="emphasis"><ICLASS="EMPHASIS">pthread&#0095;mutexattr&#0095;getpshared()</I></SPAN>,	    <SPANCLASS="emphasis"><ICLASS="EMPHASIS">pthread&#0095;mutexattr&#0095;setpshared()</I></SPAN>, 	    <SPANCLASS="emphasis"><ICLASS="EMPHASIS">pthread&#0095;condattr&#0095;getpshared()</I></SPAN> and 	    <SPANCLASS="emphasis"><ICLASS="EMPHASIS">pthread&#0095;condattr&#0095;setpshared()</I></SPAN>. 	    </P></LI><LI><P>	    Condition variables do not become bound to a particular	    mutex when	    <SPANCLASS="emphasis"><ICLASS="EMPHASIS">pthread&#0095;cond&#0095;wait()</I></SPAN> is	    called. Hence different threads may wait on a condition	    variable with different mutexes. This is at variance with	    the standard, which requires a condition variable to	    become (dynamically) bound by the first waiter, and	    unbound when the last finishes. However, this difference	    is largely benign, and the cost of policing this feature	    is non-trivial.	  </P></LI></UL></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="posix-data-interchange-format.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="posix-memory-management.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Data Interchange Format &#0091;POSIX Section 10&#0093;</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="posix-standard-support.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Memory Management &#0091;POSIX Section 12&#0093;</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -