source: rtems/cpukit/posix/src/pthreadinitthreads.c @ e42e069

4.115
Last change on this file since e42e069 was e42e069, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/05/11 at 08:50:56

2011-12-05 Ralf Corsépius <ralf.corsepius@…>

  • posix/src/pthreadinitthreads.c: Fix typos.
  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2008.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <errno.h>
17#include <pthread.h>
18#include <limits.h>
19
20#include <rtems/system.h>
21#include <rtems/config.h>
22#include <rtems/score/apiext.h>
23#include <rtems/score/stack.h>
24#include <rtems/score/thread.h>
25#include <rtems/score/userext.h>
26#include <rtems/score/wkspace.h>
27#include <rtems/posix/cancel.h>
28#include <rtems/posix/pthread.h>
29#include <rtems/posix/priority.h>
30#include <rtems/posix/psignal.h>
31#include <rtems/posix/config.h>
32#include <rtems/posix/key.h>
33#include <rtems/posix/time.h>
34
35/*
36 *  _POSIX_Threads_Initialize_user_threads_body
37 *
38 *  This routine creates and starts all configured user
39 *  initialization threads.
40 *
41 *  Input parameters: NONE
42 *
43 *  Output parameters:  NONE
44 */
45
46void _POSIX_Threads_Initialize_user_threads_body(void)
47{
48  int                                 status;
49  uint32_t                            index;
50  uint32_t                            maximum;
51  posix_initialization_threads_table *user_threads;
52  pthread_t                           thread_id;
53  pthread_attr_t                      attr;
54
55  user_threads = Configuration_POSIX_API.User_initialization_threads_table;
56  maximum      = Configuration_POSIX_API.number_of_initialization_threads;
57
58  if ( !user_threads || maximum == 0 )
59    return;
60
61  /*
62   *  Be careful .. if the default attribute set changes, this may need to.
63   *
64   *  Setting the attributes explicitly is critical, since we don't want
65   *  to inherit the idle tasks attributes.
66   */
67
68  for ( index=0 ; index < maximum ; index++ ) {
69    /*
70     * There is no way for these calls to fail in this situation.
71     */
72    (void) pthread_attr_init( &attr );
73    (void) pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
74    (void) pthread_attr_setstacksize(&attr, user_threads[ index ].stack_size);
75
76    status = pthread_create(
77      &thread_id,
78      &attr,
79      user_threads[ index ].thread_entry,
80      NULL
81    );
82    if ( status )
83      _Internal_error_Occurred( INTERNAL_ERROR_POSIX_API, true, status );
84  }
85}
86
Note: See TracBrowser for help on using the repository browser.