This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new d78d94e1fab pthread: reorganized the locations of pthread-related
functions and constants
d78d94e1fab is described below
commit d78d94e1fab58d512b82e7199ae774990dead146
Author: guoshichao <[email protected]>
AuthorDate: Thu Aug 7 14:14:40 2025 +0800
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 <[email protected]>
---
include/pthread.h | 50 --------------------------------------------------
include/signal.h | 5 +++++
include/sys/types.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/include/pthread.h b/include/pthread.h
index bd45f87ee9e..50ea4fbb80a 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -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 */
diff --git a/include/signal.h b/include/signal.h
index b63d77aa999..f3d9ccd165e 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -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
}
diff --git a/include/sys/types.h b/include/sys/types.h
index e059ef20ab6..71636dd1a05 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -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
****************************************************************************/