Skip to content
Snippets Groups Projects
Commit 1822b863 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

Fix some conditional compilation in kernel build mode. And, while we are...

Fix some conditional compilation in kernel build mode.  And, while we are touching this logic, make g_default_pthread_attr const.
parent f52b92a5
No related branches found
No related tags found
No related merge requests found
......@@ -70,11 +70,11 @@ extern "C" {
#define EXTERN extern
#endif
/* Default pthread attributes (see sched/pthread_create.c). This global
* can only be shared within the kernel- or within the user- address space.
/* Default pthread attributes. This global can only be shared within the
* kernel- or within the user- address space.
*/
EXTERN pthread_attr_t g_default_pthread_attr;
EXTERN const pthread_attr_t g_default_pthread_attr;
/****************************************************************************
* Public Function Prototypes
......
......@@ -58,15 +58,15 @@
* Global Variables
****************************************************************************/
/* Default pthread attributes (see included/nuttx/pthread.h). When configured
/* Default pthread attributes (see include/nuttx/pthread.h). When configured
* to build separate kernel- and user-address spaces, this global is
* duplicated in each address spaced. This copy can only be shared within
* the user address space.
*/
#if (defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)) && \
!defined(CONFIG_BUILD_KERNEL)
pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \
!defined(__KERNEL__)
const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
#endif
/****************************************************************************
......
......@@ -68,10 +68,13 @@
/****************************************************************************
* Global Variables
****************************************************************************/
/* Default pthread attributes (see include/nuttx/pthread.h). When configured
* to build separate kernel- and user-address spaces, this global is
* duplicated in each address spaced. This copy can only be shared within
* the kernel address space.
*/
/* Default pthread attributes */
pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
/****************************************************************************
* Private Variables
......@@ -242,7 +245,7 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
if (!attr)
{
attr = &g_default_pthread_attr;
attr = (FAR pthread_attr_t *)&g_default_pthread_attr;
}
/* Allocate a TCB for the new task. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment