pthread: reorganized the locations of pthread-related functions and constants

1. According to the POSIX specification, the functions `pthread_kill`
and `pthread_sigmask` have been moved from `pthread.h` to `signal.h`.
2. As required by the POSIX standard, the pthread-related constants
have been relocated from `pthread.h` to `sys/types.h`.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
This commit is contained in:
guoshichao
2025-08-07 14:14:40 +08:00
committed by Alan C. Assis
parent c7386775a7
commit d78d94e1fa
3 changed files with 50 additions and 50 deletions
-50
View File
@@ -774,11 +774,6 @@ int pthread_rwlock_clockwrlock(FAR pthread_rwlock_t *lock,
int pthread_rwlock_trywrlock(FAR pthread_rwlock_t *lock);
int pthread_rwlock_unlock(FAR pthread_rwlock_t *lock);
/* Pthread signal management APIs */
int pthread_kill(pthread_t thread, int sig);
int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
#ifdef CONFIG_PTHREAD_SPINLOCKS
/* Pthread spinlocks */
@@ -820,50 +815,11 @@ int pthread_atfork(CODE void (*prepare)(void),
* available in any inclusion ordering.
*/
#ifndef __PTHREAD_KEY_T_DEFINED
typedef int pthread_key_t;
# define __PTHREAD_KEY_T_DEFINED 1
#endif
#ifndef __PTHREAD_ADDR_T_DEFINED
typedef FAR void *pthread_addr_t;
# define __PTHREAD_ADDR_T_DEFINED 1
#endif
#ifndef __PTHREAD_ATTR_T_DEFINED
struct pthread_attr_s;
typedef struct pthread_attr_s pthread_attr_t;
# define __PTHREAD_ATTR_T_DEFINED 1
#endif
#ifndef __PTHREAD_T_DEFINED
typedef pid_t pthread_t;
# define __PTHREAD_T_DEFINED 1
#endif
#ifndef __PTHREAD_CONDATTR_T_DEFINED
typedef struct pthread_condattr_s pthread_condattr_t;
# define __PTHREAD_CONDATTR_T_DEFINED 1
#endif
#ifndef __PTHREAD_COND_T_DEFINED
struct pthread_cond_s;
typedef struct pthread_cond_s pthread_cond_t;
# define __PTHREAD_COND_T_DEFINED 1
#endif
#ifndef __PTHREAD_MUTEXATTR_T_DEFINED
struct pthread_mutexattr_s;
typedef struct pthread_mutexattr_s pthread_mutexattr_t;
# define __PTHREAD_MUTEXATTR_T_DEFINED 1
#endif
#ifndef __PTHREAD_MUTEX_T_DEFINED
struct pthread_mutex_s;
typedef struct pthread_mutex_s pthread_mutex_t;
# define __PTHREAD_MUTEX_T_DEFINED 1
#endif
#ifndef __PTHREAD_BARRIERATTR_T_DEFINED
struct pthread_barrierattr_s;
typedef struct pthread_barrierattr_s pthread_barrierattr_t;
@@ -896,10 +852,4 @@ typedef struct pthread_spinlock_s pthread_spinlock_t;
# endif
#endif /* CONFIG_PTHREAD_SPINLOCKS */
#ifndef __PTHREAD_ONCE_T_DEFINED
struct pthread_once_s;
typedef struct pthread_once_s pthread_once_t;
# define __PTHREAD_ONCE_T_DEFINED 1
#endif
#endif /* __INCLUDE_PTHREAD_H */
+5
View File
@@ -486,6 +486,11 @@ int sigwaitinfo(FAR const sigset_t *set, FAR struct siginfo *value);
int sigaltstack(FAR const stack_t *ss, FAR stack_t *oss);
int siginterrupt(int signo, int flag);
/* Pthread signal management APIs */
int pthread_kill(pthread_t thread, int sig);
int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
#undef EXTERN
#ifdef __cplusplus
}
+45
View File
@@ -323,6 +323,51 @@ enum
OK = 0
};
#ifndef __PTHREAD_ATTR_T_DEFINED
struct pthread_attr_s;
typedef struct pthread_attr_s pthread_attr_t;
# define __PTHREAD_ATTR_T_DEFINED 1
#endif
#ifndef __PTHREAD_COND_T_DEFINED
struct pthread_cond_s;
typedef struct pthread_cond_s pthread_cond_t;
# define __PTHREAD_COND_T_DEFINED 1
#endif
#ifndef __PTHREAD_CONDATTR_T_DEFINED
typedef struct pthread_condattr_s pthread_condattr_t;
# define __PTHREAD_CONDATTR_T_DEFINED 1
#endif
#ifndef __PTHREAD_KEY_T_DEFINED
typedef int pthread_key_t;
# define __PTHREAD_KEY_T_DEFINED 1
#endif
#ifndef __PTHREAD_MUTEX_T_DEFINED
struct pthread_mutex_s;
typedef struct pthread_mutex_s pthread_mutex_t;
# define __PTHREAD_MUTEX_T_DEFINED 1
#endif
#ifndef __PTHREAD_MUTEXATTR_T_DEFINED
struct pthread_mutexattr_s;
typedef struct pthread_mutexattr_s pthread_mutexattr_t;
# define __PTHREAD_MUTEXATTR_T_DEFINED 1
#endif
#ifndef __PTHREAD_T_DEFINED
typedef pid_t pthread_t;
# define __PTHREAD_T_DEFINED 1
#endif
#ifndef __PTHREAD_ONCE_T_DEFINED
struct pthread_once_s;
typedef struct pthread_once_s pthread_once_t;
# define __PTHREAD_ONCE_T_DEFINED 1
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/