URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [posix-synchronization.html] - Rev 314
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 >Synchronization [POSIX Section 11]</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="POSIX Standard Support" HREF="posix-standard-support.html"><LINK REL="PREVIOUS" TITLE="Data Interchange Format [POSIX Section 10]" HREF="posix-data-interchange-format.html"><LINK REL="NEXT" TITLE="Memory Management [POSIX Section 12]" HREF="posix-memory-management.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="posix-data-interchange-format.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 31. POSIX Standard Support</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="posix-memory-management.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="POSIX-SYNCHRONIZATION">Synchronization [POSIX Section 11]</H1 ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN13150">Functions Implemented</H2 ><TABLE BORDER="5" BGCOLOR="#E0E0F0" WIDTH="70%" ><TR ><TD ><PRE CLASS="SCREEN" >int sem_init(sem_t *sem, int pshared, unsigned int value); int sem_destroy(sem_t *sem); int sem_wait(sem_t *sem); int sem_trywait(sem_t *sem); int sem_post(sem_t *sem); int sem_getvalue(sem_t *sem, int *sval); int pthread_mutexattr_init( pthread_mutexattr_t *attr); int pthread_mutexattr_destroy( pthread_mutexattr_t *attr); int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutex_attr); int pthread_mutex_destroy(pthread_mutex_t *mutex); int pthread_mutex_lock(pthread_mutex_t *mutex); int pthread_mutex_trylock(pthread_mutex_t *mutex); int pthread_mutex_unlock(pthread_mutex_t *mutex); int pthread_condattr_init(pthread_condattr_t *attr); int pthread_condattr_destroy(pthread_condattr_t *attr); int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr); int pthread_cond_destroy(pthread_cond_t *cond); int pthread_cond_signal(pthread_cond_t *cond); int pthread_cond_broadcast(pthread_cond_t *cond); int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime);</PRE ></TD ></TR ></TABLE ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN13153">Functions Omitted</H2 ><TABLE BORDER="5" BGCOLOR="#E0E0F0" WIDTH="70%" ><TR ><TD ><PRE CLASS="SCREEN" >sem_t *sem_open(const char *name, int oflag, ...); // TBA int sem_close(sem_t *sem); // TBA int sem_unlink(const char *name); // TBA int pthread_mutexattr_getpshared( const pthread_mutexattr_t *attr, int *pshared ); int pthread_mutexattr_setpshared( const pthread_mutexattr_t *attr, int pshared ); int pthread_condattr_getpshared( const pthread_condattr_t *attr, int *pshared); int pthread_condattr_setpshared( const pthread_condattr_t *attr, int pshared);</PRE ></TD ></TR ></TABLE ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN13156">Notes</H2 ><P ></P ><UL ><LI ><P > The presence of semaphores is controlled by the CYGPKG_POSIX_SEMAPHORES option. This in turn causes the _POSIX_SEMAPHORES feature test macro to be defined and the semaphore API to be made available. </P ></LI ><LI ><P > The <SPAN CLASS="strong" ><B CLASS="EMPHASIS" >pshared</B ></SPAN > argument to <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >sem_init()</I ></SPAN > is not implemented, its value is ignored. </P ></LI ><LI ><P > Functions <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >sem_open()</I ></SPAN >, <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >sem_close()</I ></SPAN > and <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >sem_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 _POSIX_THREAD_PRIO_INHERIT and _POSIX_THREAD_PRIO_PROTECT configuration options. </P ></LI ><LI ><P > {_POSIX_THREAD_PROCESS_SHARED} is not defined, so the <SPAN CLASS="strong" ><B CLASS="EMPHASIS" >process-shared</B ></SPAN > mutex and condition variable attributes are not supported, and neither are the functions <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >pthread_mutexattr_getpshared()</I ></SPAN >, <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >pthread_mutexattr_setpshared()</I ></SPAN >, <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >pthread_condattr_getpshared()</I ></SPAN > and <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >pthread_condattr_setpshared()</I ></SPAN >. </P ></LI ><LI ><P > Condition variables do not become bound to a particular mutex when <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >pthread_cond_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 ><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="posix-data-interchange-format.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="posix-memory-management.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Data Interchange Format [POSIX Section 10]</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="posix-standard-support.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Memory Management [POSIX Section 12]</TD ></TR ></TABLE ></DIV ></BODY ></HTML >
Go to most recent revision | Compare with Previous | Blame | View Log