pthreads: Move pthread_barrier_init, pthread_barrier_destroy, and pthread_barrier_wait from sched/pthreads to libc/pthreads. This just coordinate other OS interface calls but are not a fundamental OS interfaces and, hence, do not belong within the OS.

This commit is contained in:
Gregory Nutt 2017-06-14 07:59:54 -06:00
parent ae168bffa0
commit 23a6ff5846
10 changed files with 31 additions and 40 deletions

View File

@ -396,32 +396,29 @@
/* The following are defined if pthreads are enabled */ /* The following are defined if pthreads are enabled */
#ifndef CONFIG_DISABLE_PTHREAD #ifndef CONFIG_DISABLE_PTHREAD
# define SYS_pthread_barrier_destroy (__SYS_pthread+0) # define SYS_pthread_cancel (__SYS_pthread+0)
# define SYS_pthread_barrier_init (__SYS_pthread+1) # define SYS_pthread_cond_broadcast (__SYS_pthread+1)
# define SYS_pthread_barrier_wait (__SYS_pthread+2) # define SYS_pthread_cond_signal (__SYS_pthread+2)
# define SYS_pthread_cancel (__SYS_pthread+3) # define SYS_pthread_cond_wait (__SYS_pthread+3)
# define SYS_pthread_cond_broadcast (__SYS_pthread+4) # define SYS_pthread_create (__SYS_pthread+4)
# define SYS_pthread_cond_signal (__SYS_pthread+5) # define SYS_pthread_detach (__SYS_pthread+5)
# define SYS_pthread_cond_wait (__SYS_pthread+6) # define SYS_pthread_exit (__SYS_pthread+6)
# define SYS_pthread_create (__SYS_pthread+7) # define SYS_pthread_getschedparam (__SYS_pthread+7)
# define SYS_pthread_detach (__SYS_pthread+8) # define SYS_pthread_getspecific (__SYS_pthread+8)
# define SYS_pthread_exit (__SYS_pthread+9) # define SYS_pthread_join (__SYS_pthread+9)
# define SYS_pthread_getschedparam (__SYS_pthread+10) # define SYS_pthread_key_create (__SYS_pthread+10)
# define SYS_pthread_getspecific (__SYS_pthread+11) # define SYS_pthread_key_delete (__SYS_pthread+11)
# define SYS_pthread_join (__SYS_pthread+12) # define SYS_pthread_mutex_destroy (__SYS_pthread+12)
# define SYS_pthread_key_create (__SYS_pthread+13) # define SYS_pthread_mutex_init (__SYS_pthread+13)
# define SYS_pthread_key_delete (__SYS_pthread+14) # define SYS_pthread_mutex_lock (__SYS_pthread+14)
# define SYS_pthread_mutex_destroy (__SYS_pthread+15) # define SYS_pthread_mutex_trylock (__SYS_pthread+15)
# define SYS_pthread_mutex_init (__SYS_pthread+16) # define SYS_pthread_mutex_unlock (__SYS_pthread+16)
# define SYS_pthread_mutex_lock (__SYS_pthread+17)
# define SYS_pthread_mutex_trylock (__SYS_pthread+18)
# define SYS_pthread_mutex_unlock (__SYS_pthread+19)
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE #ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
# define SYS_pthread_mutex_consistent (__SYS_pthread+20) # define SYS_pthread_mutex_consistent (__SYS_pthread+17)
# define __SYS_pthread_setschedparam (__SYS_pthread+21) # define __SYS_pthread_setschedparam (__SYS_pthread+18)
#else #else
# define __SYS_pthread_setschedparam (__SYS_pthread+20) # define __SYS_pthread_setschedparam (__SYS_pthread+17)
#endif #endif
# define SYS_pthread_setschedparam (__SYS_pthread_setschedparam+0) # define SYS_pthread_setschedparam (__SYS_pthread_setschedparam+0)

View File

@ -109,6 +109,9 @@
"pthread_barrierattr_getpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_barrierattr_t *","FAR int *" "pthread_barrierattr_getpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_barrierattr_t *","FAR int *"
"pthread_barrierattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *" "pthread_barrierattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *"
"pthread_barrierattr_setpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *","int" "pthread_barrierattr_setpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *","int"
"pthread_barrier_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*"
"pthread_barrier_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*","FAR const pthread_barrierattr_t*","unsigned int"
"pthread_barrier_wait","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*"
"pthread_condattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *" "pthread_condattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *"
"pthread_condattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *" "pthread_condattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *"
"pthread_cond_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_cond_t*" "pthread_cond_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_cond_t*"

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

View File

@ -44,6 +44,7 @@ CSRCS += pthread_attr_setstacksize.c pthread_attr_getstacksize.c
CSRCS += pthread_attr_setschedparam.c pthread_attr_getschedparam.c CSRCS += pthread_attr_setschedparam.c pthread_attr_getschedparam.c
CSRCS += pthread_barrierattr_init.c pthread_barrierattr_destroy.c CSRCS += pthread_barrierattr_init.c pthread_barrierattr_destroy.c
CSRCS += pthread_barrierattr_getpshared.c pthread_barrierattr_setpshared.c CSRCS += pthread_barrierattr_getpshared.c pthread_barrierattr_setpshared.c
CSRCS += pthread_barrierinit.c pthread_barrierdestroy.c pthread_barrierwait.c
CSRCS += pthread_condattr_init.c pthread_condattr_destroy.c CSRCS += pthread_condattr_init.c pthread_condattr_destroy.c
CSRCS += pthread_condinit.c pthread_conddestroy.c CSRCS += pthread_condinit.c pthread_conddestroy.c
CSRCS += pthread_mutexattr_init.c pthread_mutexattr_destroy.c CSRCS += pthread_mutexattr_init.c pthread_mutexattr_destroy.c

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* sched/pthread/pthread_barriedestroy.c * libc/pthread/pthread_barriedestroy.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> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -87,5 +87,6 @@ int pthread_barrier_destroy(FAR pthread_barrier_t *barrier)
sem_destroy(&barrier->sem); sem_destroy(&barrier->sem);
barrier->count = 0; barrier->count = 0;
} }
return ret; return ret;
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* sched/pthread/pthread_barrieinit.c * libc/pthread/pthread_barrieinit.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> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

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

View File

@ -40,7 +40,6 @@ CSRCS += pthread_getschedparam.c pthread_setschedparam.c
CSRCS += pthread_mutexinit.c pthread_mutexdestroy.c CSRCS += pthread_mutexinit.c pthread_mutexdestroy.c
CSRCS += pthread_mutexlock.c pthread_mutextrylock.c pthread_mutexunlock.c CSRCS += pthread_mutexlock.c pthread_mutextrylock.c pthread_mutexunlock.c
CSRCS += pthread_condwait.c pthread_condsignal.c pthread_condbroadcast.c CSRCS += pthread_condwait.c pthread_condsignal.c pthread_condbroadcast.c
CSRCS += pthread_barrierinit.c pthread_barrierdestroy.c pthread_barrierwait.c
CSRCS += pthread_cancel.c CSRCS += pthread_cancel.c
CSRCS += pthread_keycreate.c pthread_setspecific.c pthread_getspecific.c CSRCS += pthread_keycreate.c pthread_setspecific.c pthread_getspecific.c
CSRCS += pthread_keydelete.c CSRCS += pthread_keydelete.c

View File

@ -65,9 +65,6 @@
"pwrite","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","ssize_t","int","FAR const void*","size_t","off_t" "pwrite","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","ssize_t","int","FAR const void*","size_t","off_t"
"posix_spawnp","spawn.h","!defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_BINFMT_EXEPATH)","int","FAR pid_t *","FAR const char *","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char *const []|FAR char *const *","FAR char *const []" "posix_spawnp","spawn.h","!defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_BINFMT_EXEPATH)","int","FAR pid_t *","FAR const char *","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char *const []|FAR char *const *","FAR char *const []"
"posix_spawn","spawn.h","!defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) && !defined(CONFIG_BINFMT_EXEPATH)","int","FAR pid_t *","FAR const char *","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char *const []|FAR char *const *","FAR char *const []|FAR char *const *" "posix_spawn","spawn.h","!defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) && !defined(CONFIG_BINFMT_EXEPATH)","int","FAR pid_t *","FAR const char *","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char *const []|FAR char *const *","FAR char *const []|FAR char *const *"
"pthread_barrier_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*"
"pthread_barrier_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*","FAR const pthread_barrierattr_t*","unsigned int"
"pthread_barrier_wait","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*"
"pthread_cancel","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t" "pthread_cancel","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t"
"pthread_cleanup_pop","pthread.h","defined(CONFIG_PTHREAD_CLEANUP)","void","int" "pthread_cleanup_pop","pthread.h","defined(CONFIG_PTHREAD_CLEANUP)","void","int"
"pthread_cleanup_push","pthread.h","defined(CONFIG_PTHREAD_CLEANUP)","void","pthread_cleanup_t","FAR void*" "pthread_cleanup_push","pthread.h","defined(CONFIG_PTHREAD_CLEANUP)","void","pthread_cleanup_t","FAR void*"

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

View File

@ -281,9 +281,6 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
/* The following are defined if pthreads are enabled */ /* The following are defined if pthreads are enabled */
#ifndef CONFIG_DISABLE_PTHREAD #ifndef CONFIG_DISABLE_PTHREAD
SYSCALL_LOOKUP(pthread_barrier_destroy, 1, STUB_pthread_barrier_destroy)
SYSCALL_LOOKUP(pthread_barrier_init, 3, STUB_pthread_barrier_init)
SYSCALL_LOOKUP(pthread_barrier_wait, 1, STUB_pthread_barrier_wait)
SYSCALL_LOOKUP(pthread_cancel, 1, STUB_pthread_cancel) SYSCALL_LOOKUP(pthread_cancel, 1, STUB_pthread_cancel)
SYSCALL_LOOKUP(pthread_cond_broadcast, 1, STUB_pthread_cond_broadcast) SYSCALL_LOOKUP(pthread_cond_broadcast, 1, STUB_pthread_cond_broadcast)
SYSCALL_LOOKUP(pthread_cond_signal, 1, STUB_pthread_cond_signal) SYSCALL_LOOKUP(pthread_cond_signal, 1, STUB_pthread_cond_signal)

View File

@ -275,10 +275,6 @@ uintptr_t STUB_shmdt(int nbr, uintptr_t parm1);
/* The following are defined if pthreads are enabled */ /* The following are defined if pthreads are enabled */
uintptr_t STUB_pthread_barrier_destroy(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_barrier_init(int nbr, uintptr_t parm1,
uintptr_t parm2, uintptr_t parm3);
uintptr_t STUB_pthread_barrier_wait(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_cancel(int nbr, uintptr_t parm1); uintptr_t STUB_pthread_cancel(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_cond_broadcast(int nbr, uintptr_t parm1); uintptr_t STUB_pthread_cond_broadcast(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_cond_signal(int nbr, uintptr_t parm1); uintptr_t STUB_pthread_cond_signal(int nbr, uintptr_t parm1);