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 >Thread Management [POSIX Section 16]</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="Message Passing [POSIX Section 15]"
26 HREF="posix-message-passing.html"><LINK
28 TITLE="Thread-Specific Data [POSIX Section 17]"
29 HREF="posix-thread-specific-data.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="posix-message-passing.html"
65 >Chapter 31. POSIX Standard Support</TD
71 HREF="posix-thread-specific-data.html"
85 NAME="POSIX-THREAD-MANAGEMENT">Thread Management [POSIX Section 16]</H1
91 NAME="AEN13263">Functions Implemented</H2
100 >int pthread_attr_init(pthread_attr_t *attr);
101 int pthread_attr_destroy(pthread_attr_t *attr);
102 int pthread_attr_setdetachstate(pthread_attr_t *attr,
104 int pthread_attr_getdetachstate(const pthread_attr_t *attr,
105 int *detachstate);
106 int pthread_attr_setstackaddr(pthread_attr_t *attr,
107 void *stackaddr);
108 int pthread_attr_getstackaddr(const pthread_attr_t *attr,
109 void **stackaddr);
110 int pthread_attr_setstacksize(pthread_attr_t *attr,
111 size_t stacksize);
112 int pthread_attr_getstacksize(const pthread_attr_t *attr,
113 size_t *stacksize);
114 int pthread_create( pthread_t *thread,
115 const pthread_attr_t *attr,
116 void *(*start_routine)(void *),
118 pthread_t pthread_self( void );
119 int pthread_equal(pthread_t thread1, pthread_t thread2);
120 void pthread_exit(void *retval);
121 int pthread_join(pthread_t thread, void **thread_return);
122 int pthread_detach(pthread_t thread);
123 int pthread_once(pthread_once_t *once_control,
124 void (*init_routine)(void));</PRE
134 NAME="AEN13266">Functions Omitted</H2
143 NAME="AEN13269">Notes</H2
149 > The presence of thread support as a whole is controlled by the the
150 CYGPKG_POSIX_PTHREAD configuration option. Note that disabling
151 this will also disable many other features of the POSIX package,
152 since these are intimately bound up with the thread mechanism.
157 > The default (non-scheduling) thread attributes are:
167 > detachstate PTHREAD_CREATE_JOINABLE
177 > Dynamic thread stack allocation is only provided if there is an
185 > configured (i.e. a package
187 CYGINT_MEMALLOC_MALLOC_ALLOCATORS
188 interface). If there is no malloc() available, then the thread
189 creator must supply a stack. If only a stack address is supplied
190 then the stack is assumed to be PTHREAD_STACK_MIN
191 bytes long. This size is seldom useful for any but the most
192 trivial of threads. If a different sized stack is used, both
193 the stack address and stack size must be supplied.
198 > The value of PTHREAD_THREADS_MAX is supplied by
199 the CYGNUM_POSIX_PTHREAD_THREADS_MAX
200 option. This defines the maximum number of threads allowed. The
201 POSIX standard requires this value to be at least 64, and this
202 is the default value set.
207 > When the POSIX package is installed, the thread that calls
214 > is initialized as a POSIX thread. The
215 priority of that thread is controlled by the
216 CYGNUM_POSIX_MAIN_DEFAULT_PRIORITY option.
227 SUMMARY="Footer navigation table"
238 HREF="posix-message-passing.html"
256 HREF="posix-thread-specific-data.html"
266 >Message Passing [POSIX Section 15]</TD
272 HREF="posix-standard-support.html"
280 >Thread-Specific Data [POSIX Section 17]</TD