Changeset bd5be58f in rtems


Ignore:
Timestamp:
Oct 10, 2017, 5:18:09 AM (18 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
db3a3de
Parents:
4f9ed26
Message:

posix: Unconditional thread attribute support

Update #2514.

Location:
cpukit/posix
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/Makefile.am

    r4f9ed26 rbd5be58f  
    2525include_rtems_posix_HEADERS += include/rtems/posix/posixapi.h
    2626include_rtems_posix_HEADERS += include/rtems/posix/priorityimpl.h
     27include_rtems_posix_HEADERS += include/rtems/posix/pthreadattrimpl.h
    2728include_rtems_posix_HEADERS += include/rtems/posix/rwlockimpl.h
    2829include_rtems_posix_HEADERS += include/rtems/posix/semaphore.h
     
    9091    src/mutextrylock.c src/mutexunlock.c
    9192
     93## PTHREAD_ATTR_C_FILES
     94libposix_a_SOURCES += src/pthreadattrdefault.c src/pthreadattrdestroy.c \
     95   src/pthreadattrgetdetachstate.c src/pthreadattrgetguardsize.c \
     96   src/pthreadattrgetinheritsched.c src/pthreadattrgetschedparam.c \
     97   src/pthreadattrgetschedpolicy.c src/pthreadattrgetscope.c \
     98   src/pthreadattrgetstackaddr.c src/pthreadattrgetstack.c \
     99   src/pthreadattrgetstacksize.c src/pthreadattrinit.c \
     100   src/pthreadattrsetdetachstate.c src/pthreadattrsetguardsize.c \
     101   src/pthreadattrsetinheritsched.c src/pthreadattrsetschedparam.c \
     102   src/pthreadattrsetschedpolicy.c src/pthreadattrsetscope.c \
     103   src/pthreadattrsetstackaddr.c src/pthreadattrsetstack.c \
     104   src/pthreadattrsetstacksize.c
     105
    92106## PTHREAD_AFFINITY_C_FILES
    93107libposix_a_SOURCES += src/pthreadattrsetaffinitynp.c \
     
    96110
    97111if HAS_PTHREADS
    98 libposix_a_SOURCES +=  src/pthreadatfork.c
    99 
    100112## CANCEL_C_FILES
    101113libposix_a_SOURCES += src/cancel.c \
     
    129141
    130142## PTHREAD_C_FILES
    131 libposix_a_SOURCES += src/pthreadatfork.c src/pthreadattrdestroy.c \
    132     src/pthreadattrgetdetachstate.c src/pthreadattrgetinheritsched.c \
    133     src/pthreadattrgetschedparam.c src/pthreadattrgetschedpolicy.c \
    134     src/pthreadattrgetscope.c src/pthreadattrgetstackaddr.c \
    135     src/pthreadattrgetstack.c src/pthreadattrgetstacksize.c \
    136     src/pthreadattrinit.c src/pthreadattrsetdetachstate.c \
    137     src/pthreadattrsetguardsize.c src/pthreadattrsetinheritsched.c \
    138     src/pthreadattrsetschedparam.c src/pthreadattrsetschedpolicy.c \
    139     src/pthreadattrsetscope.c src/pthreadattrsetstackaddr.c \
    140     src/pthreadattrsetstack.c src/pthreadattrsetstacksize.c \
     143libposix_a_SOURCES += src/pthreadatfork.c \
    141144    src/pthreadgetattrnp.c \
    142     src/pthreadattrgetguardsize.c src/pthread.c \
     145    src/pthread.c \
    143146    src/pthreadconcurrency.c \
    144147    src/pthreadcreate.c src/pthreaddetach.c src/pthreadequal.c \
  • cpukit/posix/include/rtems/posix/pthreadimpl.h

    r4f9ed26 rbd5be58f  
    4848 */
    4949extern Thread_Information _POSIX_Threads_Information;
    50 
    51 /**
    52  * This variable contains the default POSIX Thread attributes.
    53  */
    54 extern const pthread_attr_t _POSIX_Threads_Default_attributes;
    5550
    5651RTEMS_INLINE_ROUTINE void _POSIX_Threads_Sporadic_timer_insert(
     
    114109}
    115110
    116 RTEMS_INLINE_ROUTINE void _POSIX_Threads_Copy_attributes(
    117   pthread_attr_t        *dst_attr,
    118   const pthread_attr_t  *src_attr
    119 )
    120 {
    121   *dst_attr = *src_attr;
    122 #if defined(RTEMS_SMP)
    123   _Assert(
    124     dst_attr->affinitysetsize == sizeof(dst_attr->affinitysetpreallocated)
    125   );
    126   dst_attr->affinityset = &dst_attr->affinitysetpreallocated;
    127 #endif
    128 }
    129 
    130111RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free (
    131112  Thread_Control *the_pthread
     
    133114{
    134115  _Objects_Free( &_POSIX_Threads_Information.Objects, &the_pthread->Object );
    135 }
    136 
    137 RTEMS_INLINE_ROUTINE void _POSIX_Threads_Initialize_attributes(
    138   pthread_attr_t  *attr
    139 )
    140 {
    141   _POSIX_Threads_Copy_attributes(
    142     attr,
    143     &_POSIX_Threads_Default_attributes
    144   );
    145116}
    146117
  • cpukit/posix/preinstall.am

    r4f9ed26 rbd5be58f  
    5959        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/priorityimpl.h
    6060PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/priorityimpl.h
     61
     62$(PROJECT_INCLUDE)/rtems/posix/pthreadattrimpl.h: include/rtems/posix/pthreadattrimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     63        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/pthreadattrimpl.h
     64PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/pthreadattrimpl.h
    6165
    6266$(PROJECT_INCLUDE)/rtems/posix/rwlockimpl.h: include/rtems/posix/rwlockimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
  • cpukit/posix/src/pthread.c

    r4f9ed26 rbd5be58f  
    4444Thread_Information _POSIX_Threads_Information;
    4545
    46 /*
    47  *  The default pthreads attributes structure.
    48  *
    49  *  NOTE: Be careful .. if the default attribute set changes,
    50  *        _POSIX_Threads_Initialize_user_threads will need to be examined.
    51  */
    52 const pthread_attr_t _POSIX_Threads_Default_attributes = {
    53   .is_initialized  = true,                       /* is_initialized */
    54   .stackaddr       = NULL,                       /* stackaddr */
    55   .stacksize       = 0,                          /* stacksize -- will be adjusted to minimum */
    56   .contentionscope = PTHREAD_SCOPE_PROCESS,      /* contentionscope */
    57   .inheritsched    = PTHREAD_INHERIT_SCHED,      /* inheritsched */
    58   .schedpolicy     = SCHED_FIFO,                 /* schedpolicy */
    59   .schedparam      =
    60   {                           /* schedparam */
    61     2,                        /* sched_priority */
    62     #if defined(_POSIX_SPORADIC_SERVER) || \
    63         defined(_POSIX_THREAD_SPORADIC_SERVER)
    64       0,                        /* sched_ss_low_priority */
    65       { 0L, 0 },                /* sched_ss_repl_period */
    66       { 0L, 0 },                /* sched_ss_init_budget */
    67       0                         /* sched_ss_max_repl */
    68     #endif
    69   },
    70 
    71   #if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE
    72     .guardsize = 0,                            /* guardsize */
    73   #endif
    74   #if defined(_POSIX_THREAD_CPUTIME)
    75     .cputime_clock_allowed = 1,                        /* cputime_clock_allowed */
    76   #endif
    77   .detachstate             = PTHREAD_CREATE_JOINABLE,    /* detachstate */
    78   .affinitysetsize         =
    79     sizeof( _POSIX_Threads_Default_attributes.affinitysetpreallocated ),
    80   .affinityset             =
    81     &_POSIX_Threads_Default_attributes.affinitysetpreallocated,
    82   .affinitysetpreallocated = { { -1L } }
    83 };
    84 
    8546void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog )
    8647{
  • cpukit/posix/src/pthreadattrdestroy.c

    r4f9ed26 rbd5be58f  
    2121#include <pthread.h>
    2222#include <errno.h>
    23 
    24 #include <rtems/system.h>
     23#include <stdbool.h>
    2524
    2625int pthread_attr_destroy(
  • cpukit/posix/src/pthreadattrinit.c

    r4f9ed26 rbd5be58f  
    1919#endif
    2020
    21 #include <pthread.h>
    22 #include <errno.h>
    23 
    24 #include <rtems/system.h>
    25 #include <rtems/posix/pthreadimpl.h>
     21#include <rtems/posix/pthreadattrimpl.h>
    2622
    2723/**
  • cpukit/posix/src/pthreadattrsetguardsize.c

    r4f9ed26 rbd5be58f  
    2020
    2121#if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE
     22
    2223#include <pthread.h>
    2324#include <errno.h>
    24 
    25 #include <rtems/system.h>
    26 #include <rtems/posix/pthreadimpl.h>
    2725
    2826int pthread_attr_setguardsize(
  • cpukit/posix/src/pthreadattrsetinheritsched.c

    r4f9ed26 rbd5be58f  
    2424#include <errno.h>
    2525
    26 #include <rtems/system.h>
    27 #include <rtems/posix/pthreadimpl.h>
    28 
    2926int pthread_attr_setinheritsched(
    3027  pthread_attr_t  *attr,
  • cpukit/posix/src/pthreadattrsetschedpolicy.c

    r4f9ed26 rbd5be58f  
    2424#include <errno.h>
    2525
    26 #include <rtems/system.h>
    27 #include <rtems/posix/pthreadimpl.h>
    28 
    2926int pthread_attr_setschedpolicy(
    3027  pthread_attr_t  *attr,
  • cpukit/posix/src/pthreadattrsetscope.c

    r4f9ed26 rbd5be58f  
    2424#include <errno.h>
    2525
    26 #include <rtems/system.h>
    27 #include <rtems/posix/pthreadimpl.h>
    28 
    2926int pthread_attr_setscope(
    3027  pthread_attr_t  *attr,
  • cpukit/posix/src/pthreadcreate.c

    r4f9ed26 rbd5be58f  
    2828#include <rtems/posix/priorityimpl.h>
    2929#include <rtems/posix/pthreadimpl.h>
     30#include <rtems/posix/pthreadattrimpl.h>
    3031#include <rtems/score/assert.h>
    3132#include <rtems/score/cpusetimpl.h>
Note: See TracChangeset for help on using the changeset viewer.