1 <!-- 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. -->
12 >Synchronization [POSIX Section 11]</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="POSIX Standard Support"
23 HREF="posix-standard-support.html"><LINK
25 TITLE="Data Interchange Format [POSIX Section 10]"
26 HREF="posix-data-interchange-format.html"><LINK
28 TITLE="Memory Management [POSIX Section 12]"
29 HREF="posix-memory-management.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="posix-data-interchange-format.html"
65 >Chapter 31. POSIX Standard Support</TD
71 HREF="posix-memory-management.html"
85 NAME="POSIX-SYNCHRONIZATION">Synchronization [POSIX Section 11]</H1
91 NAME="AEN13150">Functions Implemented</H2
100 >int sem_init(sem_t *sem, int pshared, unsigned int value);
101 int sem_destroy(sem_t *sem);
102 int sem_wait(sem_t *sem);
103 int sem_trywait(sem_t *sem);
104 int sem_post(sem_t *sem);
105 int sem_getvalue(sem_t *sem, int *sval);
106 int pthread_mutexattr_init( pthread_mutexattr_t *attr);
107 int pthread_mutexattr_destroy( pthread_mutexattr_t *attr);
108 int pthread_mutex_init(pthread_mutex_t *mutex,
109 const pthread_mutexattr_t *mutex_attr);
110 int pthread_mutex_destroy(pthread_mutex_t *mutex);
111 int pthread_mutex_lock(pthread_mutex_t *mutex);
112 int pthread_mutex_trylock(pthread_mutex_t *mutex);
113 int pthread_mutex_unlock(pthread_mutex_t *mutex);
114 int pthread_condattr_init(pthread_condattr_t *attr);
115 int pthread_condattr_destroy(pthread_condattr_t *attr);
116 int pthread_cond_init(pthread_cond_t *cond,
117 const pthread_condattr_t *attr);
118 int pthread_cond_destroy(pthread_cond_t *cond);
119 int pthread_cond_signal(pthread_cond_t *cond);
120 int pthread_cond_broadcast(pthread_cond_t *cond);
121 int pthread_cond_wait(pthread_cond_t *cond,
122 pthread_mutex_t *mutex);
123 int pthread_cond_timedwait(pthread_cond_t *cond,
124 pthread_mutex_t *mutex,
125 const struct timespec *abstime);</PRE
135 NAME="AEN13153">Functions Omitted</H2
144 >sem_t *sem_open(const char *name, int oflag, ...); // TBA
145 int sem_close(sem_t *sem); // TBA
146 int sem_unlink(const char *name); // TBA
147 int pthread_mutexattr_getpshared( const pthread_mutexattr_t *attr,
148 int *pshared );
149 int pthread_mutexattr_setpshared( const pthread_mutexattr_t *attr,
151 int pthread_condattr_getpshared( const pthread_condattr_t *attr,
153 int pthread_condattr_setpshared( const pthread_condattr_t *attr,
164 NAME="AEN13156">Notes</H2
170 > The presence of semaphores is controlled by the
171 CYGPKG_POSIX_SEMAPHORES option. This in turn
172 causes the _POSIX_SEMAPHORES feature test
173 macro to be defined and the semaphore API to be made
192 > is not implemented,
193 its value is ignored.
209 >sem_close()</I
216 >sem_unlink()</I
219 always return an error (ENOSYS).
224 > The exact priority inversion protocols supported may be
226 _POSIX_THREAD_PRIO_INHERIT and
227 _POSIX_THREAD_PRIO_PROTECT
228 configuration options.
233 > {_POSIX_THREAD_PROCESS_SHARED} is
242 and condition variable attributes are not supported, and
243 neither are the functions
248 >pthread_mutexattr_getpshared()</I
255 >pthread_mutexattr_setpshared()</I
262 >pthread_condattr_getpshared()</I
269 >pthread_condattr_setpshared()</I
276 > Condition variables do not become bound to a particular
282 >pthread_cond_wait()</I
285 called. Hence different threads may wait on a condition
286 variable with different mutexes. This is at variance with
287 the standard, which requires a condition variable to
288 become (dynamically) bound by the first waiter, and
289 unbound when the last finishes. However, this difference
290 is largely benign, and the cost of policing this feature
302 SUMMARY="Footer navigation table"
313 HREF="posix-data-interchange-format.html"
331 HREF="posix-memory-management.html"
341 >Data Interchange Format [POSIX Section 10]</TD
347 HREF="posix-standard-support.html"
355 >Memory Management [POSIX Section 12]</TD