forked from Imagelibrary/rtems
@@ -24,6 +24,7 @@ include_rtems_posix_HEADERS += include/rtems/posix/config.h
|
||||
include_rtems_posix_HEADERS += include/rtems/posix/muteximpl.h
|
||||
include_rtems_posix_HEADERS += include/rtems/posix/posixapi.h
|
||||
include_rtems_posix_HEADERS += include/rtems/posix/priorityimpl.h
|
||||
include_rtems_posix_HEADERS += include/rtems/posix/pthreadattrimpl.h
|
||||
include_rtems_posix_HEADERS += include/rtems/posix/rwlockimpl.h
|
||||
include_rtems_posix_HEADERS += include/rtems/posix/semaphore.h
|
||||
include_rtems_posix_HEADERS += include/rtems/posix/semaphoreimpl.h
|
||||
@@ -89,14 +90,25 @@ libposix_a_SOURCES += src/mutexattrdestroy.c src/mutexattrgetprioceiling.c \
|
||||
src/mutexlocksupp.c src/mutexsetprioceiling.c src/mutextimedlock.c \
|
||||
src/mutextrylock.c src/mutexunlock.c
|
||||
|
||||
## PTHREAD_ATTR_C_FILES
|
||||
libposix_a_SOURCES += src/pthreadattrdefault.c src/pthreadattrdestroy.c \
|
||||
src/pthreadattrgetdetachstate.c src/pthreadattrgetguardsize.c \
|
||||
src/pthreadattrgetinheritsched.c src/pthreadattrgetschedparam.c \
|
||||
src/pthreadattrgetschedpolicy.c src/pthreadattrgetscope.c \
|
||||
src/pthreadattrgetstackaddr.c src/pthreadattrgetstack.c \
|
||||
src/pthreadattrgetstacksize.c src/pthreadattrinit.c \
|
||||
src/pthreadattrsetdetachstate.c src/pthreadattrsetguardsize.c \
|
||||
src/pthreadattrsetinheritsched.c src/pthreadattrsetschedparam.c \
|
||||
src/pthreadattrsetschedpolicy.c src/pthreadattrsetscope.c \
|
||||
src/pthreadattrsetstackaddr.c src/pthreadattrsetstack.c \
|
||||
src/pthreadattrsetstacksize.c
|
||||
|
||||
## PTHREAD_AFFINITY_C_FILES
|
||||
libposix_a_SOURCES += src/pthreadattrsetaffinitynp.c \
|
||||
src/pthreadattrgetaffinitynp.c src/pthreadgetaffinitynp.c \
|
||||
src/pthreadsetaffinitynp.c
|
||||
|
||||
if HAS_PTHREADS
|
||||
libposix_a_SOURCES += src/pthreadatfork.c
|
||||
|
||||
## CANCEL_C_FILES
|
||||
libposix_a_SOURCES += src/cancel.c \
|
||||
src/cleanuppush.c src/setcancelstate.c \
|
||||
@@ -128,18 +140,9 @@ libposix_a_SOURCES += src/mqueue.c src/mqueueclose.c \
|
||||
src/mqueueunlink.c
|
||||
|
||||
## PTHREAD_C_FILES
|
||||
libposix_a_SOURCES += src/pthreadatfork.c src/pthreadattrdestroy.c \
|
||||
src/pthreadattrgetdetachstate.c src/pthreadattrgetinheritsched.c \
|
||||
src/pthreadattrgetschedparam.c src/pthreadattrgetschedpolicy.c \
|
||||
src/pthreadattrgetscope.c src/pthreadattrgetstackaddr.c \
|
||||
src/pthreadattrgetstack.c src/pthreadattrgetstacksize.c \
|
||||
src/pthreadattrinit.c src/pthreadattrsetdetachstate.c \
|
||||
src/pthreadattrsetguardsize.c src/pthreadattrsetinheritsched.c \
|
||||
src/pthreadattrsetschedparam.c src/pthreadattrsetschedpolicy.c \
|
||||
src/pthreadattrsetscope.c src/pthreadattrsetstackaddr.c \
|
||||
src/pthreadattrsetstack.c src/pthreadattrsetstacksize.c \
|
||||
libposix_a_SOURCES += src/pthreadatfork.c \
|
||||
src/pthreadgetattrnp.c \
|
||||
src/pthreadattrgetguardsize.c src/pthread.c \
|
||||
src/pthread.c \
|
||||
src/pthreadconcurrency.c \
|
||||
src/pthreadcreate.c src/pthreaddetach.c src/pthreadequal.c \
|
||||
src/pthreadexit.c src/pthreadgetcpuclockid.c \
|
||||
|
||||
71
cpukit/posix/include/rtems/posix/pthreadattrimpl.h
Normal file
71
cpukit/posix/include/rtems/posix/pthreadattrimpl.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief POSIX Threads Private Support
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX threads.
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* 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.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_POSIX_PTHREADATTRIMPL_H
|
||||
#define _RTEMS_POSIX_PTHREADATTRIMPL_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <rtems/score/basedefs.h>
|
||||
#include <rtems/score/assert.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup POSIX_PTHREAD
|
||||
*/
|
||||
/**@{**/
|
||||
|
||||
/**
|
||||
* This variable contains the default POSIX Thread attributes.
|
||||
*/
|
||||
extern const pthread_attr_t _POSIX_Threads_Default_attributes;
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Copy_attributes(
|
||||
pthread_attr_t *dst_attr,
|
||||
const pthread_attr_t *src_attr
|
||||
)
|
||||
{
|
||||
*dst_attr = *src_attr;
|
||||
_Assert(
|
||||
dst_attr->affinitysetsize == sizeof(dst_attr->affinitysetpreallocated)
|
||||
);
|
||||
dst_attr->affinityset = &dst_attr->affinitysetpreallocated;
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Initialize_attributes(
|
||||
pthread_attr_t *attr
|
||||
)
|
||||
{
|
||||
_POSIX_Threads_Copy_attributes(
|
||||
attr,
|
||||
&_POSIX_Threads_Default_attributes
|
||||
);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -48,11 +48,6 @@ extern "C" {
|
||||
*/
|
||||
extern Thread_Information _POSIX_Threads_Information;
|
||||
|
||||
/**
|
||||
* This variable contains the default POSIX Thread attributes.
|
||||
*/
|
||||
extern const pthread_attr_t _POSIX_Threads_Default_attributes;
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Sporadic_timer_insert(
|
||||
Thread_Control *the_thread,
|
||||
POSIX_API_Control *api
|
||||
@@ -113,20 +108,6 @@ RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate(void)
|
||||
_Objects_Allocate_unprotected( &_POSIX_Threads_Information.Objects );
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Copy_attributes(
|
||||
pthread_attr_t *dst_attr,
|
||||
const pthread_attr_t *src_attr
|
||||
)
|
||||
{
|
||||
*dst_attr = *src_attr;
|
||||
#if defined(RTEMS_SMP)
|
||||
_Assert(
|
||||
dst_attr->affinitysetsize == sizeof(dst_attr->affinitysetpreallocated)
|
||||
);
|
||||
dst_attr->affinityset = &dst_attr->affinitysetpreallocated;
|
||||
#endif
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free (
|
||||
Thread_Control *the_pthread
|
||||
)
|
||||
@@ -134,16 +115,6 @@ RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free (
|
||||
_Objects_Free( &_POSIX_Threads_Information.Objects, &the_pthread->Object );
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Initialize_attributes(
|
||||
pthread_attr_t *attr
|
||||
)
|
||||
{
|
||||
_POSIX_Threads_Copy_attributes(
|
||||
attr,
|
||||
&_POSIX_Threads_Default_attributes
|
||||
);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -59,6 +59,10 @@ $(PROJECT_INCLUDE)/rtems/posix/priorityimpl.h: include/rtems/posix/priorityimpl.
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/priorityimpl.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/priorityimpl.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/posix/pthreadattrimpl.h: include/rtems/posix/pthreadattrimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/pthreadattrimpl.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/pthreadattrimpl.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/posix/rwlockimpl.h: include/rtems/posix/rwlockimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/rwlockimpl.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/rwlockimpl.h
|
||||
|
||||
@@ -43,45 +43,6 @@
|
||||
|
||||
Thread_Information _POSIX_Threads_Information;
|
||||
|
||||
/*
|
||||
* The default pthreads attributes structure.
|
||||
*
|
||||
* NOTE: Be careful .. if the default attribute set changes,
|
||||
* _POSIX_Threads_Initialize_user_threads will need to be examined.
|
||||
*/
|
||||
const pthread_attr_t _POSIX_Threads_Default_attributes = {
|
||||
.is_initialized = true, /* is_initialized */
|
||||
.stackaddr = NULL, /* stackaddr */
|
||||
.stacksize = 0, /* stacksize -- will be adjusted to minimum */
|
||||
.contentionscope = PTHREAD_SCOPE_PROCESS, /* contentionscope */
|
||||
.inheritsched = PTHREAD_INHERIT_SCHED, /* inheritsched */
|
||||
.schedpolicy = SCHED_FIFO, /* schedpolicy */
|
||||
.schedparam =
|
||||
{ /* schedparam */
|
||||
2, /* sched_priority */
|
||||
#if defined(_POSIX_SPORADIC_SERVER) || \
|
||||
defined(_POSIX_THREAD_SPORADIC_SERVER)
|
||||
0, /* sched_ss_low_priority */
|
||||
{ 0L, 0 }, /* sched_ss_repl_period */
|
||||
{ 0L, 0 }, /* sched_ss_init_budget */
|
||||
0 /* sched_ss_max_repl */
|
||||
#endif
|
||||
},
|
||||
|
||||
#if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE
|
||||
.guardsize = 0, /* guardsize */
|
||||
#endif
|
||||
#if defined(_POSIX_THREAD_CPUTIME)
|
||||
.cputime_clock_allowed = 1, /* cputime_clock_allowed */
|
||||
#endif
|
||||
.detachstate = PTHREAD_CREATE_JOINABLE, /* detachstate */
|
||||
.affinitysetsize =
|
||||
sizeof( _POSIX_Threads_Default_attributes.affinitysetpreallocated ),
|
||||
.affinityset =
|
||||
&_POSIX_Threads_Default_attributes.affinitysetpreallocated,
|
||||
.affinitysetpreallocated = { { -1L } }
|
||||
};
|
||||
|
||||
void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog )
|
||||
{
|
||||
POSIX_API_Control *api;
|
||||
|
||||
60
cpukit/posix/src/pthreadattrdefault.c
Normal file
60
cpukit/posix/src/pthreadattrdefault.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Private Support Information for POSIX Threads
|
||||
* @ingroup POSIX_PTHREADS Private Threads
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2014.
|
||||
* 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.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/posix/pthreadattrimpl.h>
|
||||
|
||||
/*
|
||||
* The default pthreads attributes structure.
|
||||
*
|
||||
* NOTE: Be careful .. if the default attribute set changes,
|
||||
* _POSIX_Threads_Initialize_user_threads will need to be examined.
|
||||
*/
|
||||
const pthread_attr_t _POSIX_Threads_Default_attributes = {
|
||||
.is_initialized = true, /* is_initialized */
|
||||
.stackaddr = NULL, /* stackaddr */
|
||||
.stacksize = 0, /* stacksize -- will be adjusted to minimum */
|
||||
.contentionscope = PTHREAD_SCOPE_PROCESS, /* contentionscope */
|
||||
.inheritsched = PTHREAD_INHERIT_SCHED, /* inheritsched */
|
||||
.schedpolicy = SCHED_FIFO, /* schedpolicy */
|
||||
.schedparam =
|
||||
{ /* schedparam */
|
||||
2, /* sched_priority */
|
||||
#if defined(_POSIX_SPORADIC_SERVER) || \
|
||||
defined(_POSIX_THREAD_SPORADIC_SERVER)
|
||||
0, /* sched_ss_low_priority */
|
||||
{ 0L, 0 }, /* sched_ss_repl_period */
|
||||
{ 0L, 0 }, /* sched_ss_init_budget */
|
||||
0 /* sched_ss_max_repl */
|
||||
#endif
|
||||
},
|
||||
|
||||
#if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE
|
||||
.guardsize = 0, /* guardsize */
|
||||
#endif
|
||||
#if defined(_POSIX_THREAD_CPUTIME)
|
||||
.cputime_clock_allowed = 1, /* cputime_clock_allowed */
|
||||
#endif
|
||||
.detachstate = PTHREAD_CREATE_JOINABLE, /* detachstate */
|
||||
.affinitysetsize =
|
||||
sizeof( _POSIX_Threads_Default_attributes.affinitysetpreallocated ),
|
||||
.affinityset =
|
||||
&_POSIX_Threads_Default_attributes.affinitysetpreallocated,
|
||||
.affinitysetpreallocated = { { -1L } }
|
||||
};
|
||||
@@ -20,8 +20,7 @@
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
int pthread_attr_destroy(
|
||||
pthread_attr_t *attr
|
||||
|
||||
@@ -18,11 +18,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/posix/pthreadimpl.h>
|
||||
#include <rtems/posix/pthreadattrimpl.h>
|
||||
|
||||
/**
|
||||
* 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/posix/pthreadimpl.h>
|
||||
|
||||
int pthread_attr_setguardsize(
|
||||
pthread_attr_t *attr,
|
||||
size_t guardsize
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/posix/pthreadimpl.h>
|
||||
|
||||
int pthread_attr_setinheritsched(
|
||||
pthread_attr_t *attr,
|
||||
int inheritsched
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/posix/pthreadimpl.h>
|
||||
|
||||
int pthread_attr_setschedpolicy(
|
||||
pthread_attr_t *attr,
|
||||
int policy
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/posix/pthreadimpl.h>
|
||||
|
||||
int pthread_attr_setscope(
|
||||
pthread_attr_t *attr,
|
||||
int contentionscope
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <rtems/posix/priorityimpl.h>
|
||||
#include <rtems/posix/pthreadimpl.h>
|
||||
#include <rtems/posix/pthreadattrimpl.h>
|
||||
#include <rtems/score/assert.h>
|
||||
#include <rtems/score/cpusetimpl.h>
|
||||
#include <rtems/score/threadimpl.h>
|
||||
|
||||
Reference in New Issue
Block a user