pthreads: Move pthread_once from sched/pthreads to libc/pthreads. pthread_once just coordinates other OS interface calls but is not a fundamental OS interface and, hence, does not belong within the OS.

This commit is contained in:
Gregory Nutt 2017-06-14 07:30:49 -06:00
parent 8ae5450268
commit 557fd6504f
8 changed files with 11 additions and 14 deletions

View File

@ -421,16 +421,15 @@
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
# define SYS_pthread_mutex_consistent (__SYS_pthread+22)
# define __SYS_pthread_once (__SYS_pthread+23)
# define __SYS_pthread_setschedparam (__SYS_pthread+23)
#else
# define __SYS_pthread_once (__SYS_pthread+22)
# define __SYS_pthread_setschedparam (__SYS_pthread+22)
#endif
# define SYS_pthread_once (__SYS_pthread_once+0)
# define SYS_pthread_setschedparam (__SYS_pthread_once+1)
# define SYS_pthread_setschedprio (__SYS_pthread_once+2)
# define SYS_pthread_setspecific (__SYS_pthread_once+3)
# define __SYS_pthread_smp (__SYS_pthread_once+4)
# define SYS_pthread_setschedparam (__SYS_pthread_setschedparam+0)
# define SYS_pthread_setschedprio (__SYS_pthread_setschedparam+1)
# define SYS_pthread_setspecific (__SYS_pthread_setschedparam+2)
# define __SYS_pthread_smp (__SYS_pthread_setschedparam+3)
# ifdef CONFIG_SMP
# define SYS_pthread_setaffinity_np (__SYS_pthread_smp+0)

View File

@ -117,6 +117,7 @@
"pthread_mutexattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *"
"pthread_mutexattr_setpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *","int "
"pthread_mutexattr_settype","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_PTHREAD_MUTEX_TYPES)","int","pthread_mutexattr_t *","int"
"pthread_once","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_once_t*","CODE void (*)(void)"
"pthread_yield","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void"
"puts","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *"
"qsort","stdlib.h","","void","void *","size_t","size_t","int(*)(const void *","FAR const void *)"

Can't render this file because it has a wrong number of fields in line 2.

View File

@ -53,7 +53,7 @@ CSRCS += pthread_mutexattr_setrobust.c pthread_mutexattr_getrobust.c
CSRCS += pthread_setcancelstate.c pthread_setcanceltype.c
CSRCS += pthread_testcancel.c
CSRCS += pthread_rwlock.c pthread_rwlock_rdlock.c pthread_rwlock_wrlock.c
CSRCS += pthread_yield.c
CSRCS += pthread_once.c pthread_yield.c
ifeq ($(CONFIG_SMP),y)
CSRCS += pthread_attr_getaffinity.c pthread_attr_setaffinity.c

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread/pthread_once.c
* libc/pthread/pthread_once.c
*
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without

View File

@ -46,7 +46,7 @@ CSRCS += pthread_cancel.c
CSRCS += pthread_keycreate.c pthread_setspecific.c pthread_getspecific.c
CSRCS += pthread_keydelete.c
CSRCS += pthread_initialize.c pthread_completejoin.c pthread_findjoininfo.c
CSRCS += pthread_once.c pthread_release.c pthread_setschedprio.c
CSRCS += pthread_release.c pthread_setschedprio.c
ifneq ($(CONFIG_PTHREAD_MUTEX_UNSAFE),y)
CSRCS += pthread_mutex.c pthread_mutexconsistent.c pthread_mutexinconsistent.c

View File

@ -93,7 +93,6 @@
"pthread_mutex_trylock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*"
"pthread_mutex_unlock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*"
"pthread_mutex_consistent","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_PTHREAD_MUTEX_UNSAFE)","int","FAR pthread_mutex_t*"
"pthread_once","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_once_t*","CODE void (*)(void)"
"pthread_setaffinity_np","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SMP)","int","pthread_t","size_t","FAR const cpu_set_t*"
"pthread_setschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int","FAR const struct sched_param*"
"pthread_setschedprio","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int"

Can't render this file because it has a wrong number of fields in line 2.

View File

@ -306,7 +306,6 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
SYSCALL_LOOKUP(pthread_mutex_consistent, 1, STUB_pthread_mutex_consistent)
#endif
SYSCALL_LOOKUP(pthread_once, 2, STUB_pthread_once)
SYSCALL_LOOKUP(pthread_setschedparam, 3, STUB_pthread_setschedparam)
SYSCALL_LOOKUP(pthread_setschedprio, 2, STUB_pthread_setschedprio)
SYSCALL_LOOKUP(pthread_setspecific, 2, STUB_pthread_setspecific)

View File

@ -303,7 +303,6 @@ uintptr_t STUB_pthread_mutex_lock(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_mutex_trylock(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_mutex_unlock(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_mutex_consistent(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_once(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_pthread_setschedparam(int nbr, uintptr_t parm1,
uintptr_t parm2, uintptr_t parm3);
uintptr_t STUB_pthread_setschedprio(int nbr, uintptr_t parm1,