summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/pthreadinitthreads.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-17 20:32:13 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-17 20:32:13 +0000
commit0ab34c90a20c03d84cad1b357da8fbc0258be6c0 (patch)
tree7d12c026af64c5f6c33746e8c5681a9a562b2054 /cpukit/posix/src/pthreadinitthreads.c
parent2007-04-17 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-0ab34c90a20c03d84cad1b357da8fbc0258be6c0.tar.bz2
2007-04-17 Joel Sherrill <joel@OARcorp.com>
* itron/Makefile.am, itron/src/eventflags.c, itron/src/fmempool.c, itron/src/itronintr.c, itron/src/itrontime.c, itron/src/network.c, itron/src/port.c, itron/src/sysmgmt.c, itron/src/task.c, itron/src/vmempool.c, posix/Makefile.am, posix/src/pthread.c, rtems/src/taskinitusers.c, rtems/src/tasks.c, sapi/include/confdefs.h, sapi/src/io.c: Various modification to reduce executable size. Most were refactoring of files. Split ITRON API files. Implemented mechanism to avoid initialization task/thread loop being linked in when that style of task initialization was not being used. * itron/src/acp_por.c, itron/src/act_cyc.c, itron/src/cal_por.c, itron/src/chg_iXX.c, itron/src/clr_flg.c, itron/src/cre_flg.c, itron/src/cre_mpf.c, itron/src/cre_mpl.c, itron/src/cre_por.c, itron/src/def_alm.c, itron/src/def_cyc.c, itron/src/def_exc.c, itron/src/def_int.c, itron/src/def_svc.c, itron/src/del_flg.c, itron/src/del_mpf.c, itron/src/del_mpl.c, itron/src/del_por.c, itron/src/dis_int.c, itron/src/dly_tsk.c, itron/src/ena_int.c, itron/src/fwd_por.c, itron/src/get_blf.c, itron/src/get_blk.c, itron/src/get_tim.c, itron/src/get_ver.c, itron/src/itroninittasks.c, itron/src/loc_cpu.c, itron/src/nget_nod.c, itron/src/nget_ver.c, itron/src/nrea_dat.c, itron/src/nwri_dat.c, itron/src/pacp_por.c, itron/src/pcal_por.c, itron/src/pget_blf.c, itron/src/pget_blk.c, itron/src/pol_flg.c, itron/src/ref_alm.c, itron/src/ref_cfg.c, itron/src/ref_cyc.c, itron/src/ref_flg.c, itron/src/ref_iXX.c, itron/src/ref_mpf.c, itron/src/ref_mpl.c, itron/src/ref_por.c, itron/src/ref_sys.c, itron/src/rel_blf.c, itron/src/rel_blk.c, itron/src/ret_int.c, itron/src/ret_tmr.c, itron/src/ret_wup.c, itron/src/rpl_rdv.c, itron/src/set_flg.c, itron/src/set_tim.c, itron/src/tacp_por.c, itron/src/tcal_por.c, itron/src/tget_blf.c, itron/src/tget_blk.c, itron/src/twai_flg.c, itron/src/unl_cpu.c, itron/src/wai_flg.c, posix/src/pthreadinitthreads.c: New files.
Diffstat (limited to 'cpukit/posix/src/pthreadinitthreads.c')
-rw-r--r--cpukit/posix/src/pthreadinitthreads.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c
new file mode 100644
index 0000000000..5f71770e95
--- /dev/null
+++ b/cpukit/posix/src/pthreadinitthreads.c
@@ -0,0 +1,88 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <pthread.h>
+#include <limits.h>
+
+#include <rtems/system.h>
+#include <rtems/score/apiext.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/posix/cancel.h>
+#include <rtems/posix/pthread.h>
+#include <rtems/posix/priority.h>
+#include <rtems/posix/psignal.h>
+#include <rtems/posix/config.h>
+#include <rtems/posix/key.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * _POSIX_Threads_Initialize_user_threads_body
+ *
+ * This routine creates and starts all configured user
+ * initialzation threads.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _POSIX_Threads_Initialize_user_threads_body( void )
+{
+ int status;
+ uint32_t index;
+ uint32_t maximum;
+ posix_initialization_threads_table *user_threads;
+ pthread_t thread_id;
+ pthread_attr_t attr;
+
+ user_threads = _POSIX_Threads_User_initialization_threads;
+ maximum = _POSIX_Threads_Number_of_initialization_threads;
+
+ if ( !user_threads || maximum == 0 )
+ return;
+
+ /*
+ * Be careful .. if the default attribute set changes, this may need to.
+ *
+ * Setting the attributes explicitly is critical, since we don't want
+ * to inherit the idle tasks attributes.
+ */
+
+ for ( index=0 ; index < maximum ; index++ ) {
+ status = pthread_attr_init( &attr );
+ assert( !status );
+
+ status = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
+ assert( !status );
+
+ status = pthread_attr_setstacksize( &attr, user_threads[ index ].stack_size);
+ assert( !status );
+
+ status = pthread_create(
+ &thread_id,
+ &attr,
+ user_threads[ index ].thread_entry,
+ NULL
+ );
+ assert( !status );
+ }
+}
+