mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
include/pthread.h and signal.h: Avoid redefinition of types
This commit is contained in:
@@ -203,11 +203,15 @@ extern "C"
|
|||||||
|
|
||||||
/* pthread-specific types */
|
/* pthread-specific types */
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_KEY_T_DEFINED
|
||||||
typedef int pthread_key_t;
|
typedef int pthread_key_t;
|
||||||
#define __PTHREAD_KEY_T_DEFINED 1
|
#define __PTHREAD_KEY_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_ADDR_T_DEFINED
|
||||||
typedef FAR void *pthread_addr_t;
|
typedef FAR void *pthread_addr_t;
|
||||||
#define __PTHREAD_ADDR_T_DEFINED 1
|
#define __PTHREAD_ADDR_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef pthread_addr_t (*pthread_startroutine_t)(pthread_addr_t);
|
typedef pthread_addr_t (*pthread_startroutine_t)(pthread_addr_t);
|
||||||
typedef pthread_startroutine_t pthread_func_t;
|
typedef pthread_startroutine_t pthread_func_t;
|
||||||
@@ -236,22 +240,30 @@ struct pthread_attr_s
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_ATTR_T_DEFINED
|
||||||
typedef struct pthread_attr_s pthread_attr_t;
|
typedef struct pthread_attr_s pthread_attr_t;
|
||||||
#define __PTHREAD_ATTR_T_DEFINED 1
|
#define __PTHREAD_ATTR_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_T_DEFINED
|
||||||
typedef pid_t pthread_t;
|
typedef pid_t pthread_t;
|
||||||
#define __PTHREAD_T_DEFINED 1
|
#define __PTHREAD_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_CONDATTR_T_DEFINED
|
||||||
typedef int pthread_condattr_t;
|
typedef int pthread_condattr_t;
|
||||||
#define __PTHREAD_CONDATTR_T_DEFINED 1
|
#define __PTHREAD_CONDATTR_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
struct pthread_cond_s
|
struct pthread_cond_s
|
||||||
{
|
{
|
||||||
sem_t sem;
|
sem_t sem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_COND_T_DEFINED
|
||||||
typedef struct pthread_cond_s pthread_cond_t;
|
typedef struct pthread_cond_s pthread_cond_t;
|
||||||
#define __PTHREAD_COND_T_DEFINED 1
|
#define __PTHREAD_COND_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PTHREAD_COND_INITIALIZER {SEM_INITIALIZER(0)}
|
#define PTHREAD_COND_INITIALIZER {SEM_INITIALIZER(0)}
|
||||||
|
|
||||||
@@ -269,8 +281,10 @@ struct pthread_mutexattr_s
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_MUTEXATTR_T_DEFINED
|
||||||
typedef struct pthread_mutexattr_s pthread_mutexattr_t;
|
typedef struct pthread_mutexattr_s pthread_mutexattr_t;
|
||||||
#define __PTHREAD_MUTEXATTR_T_DEFINED 1
|
#define __PTHREAD_MUTEXATTR_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
struct pthread_mutex_s
|
struct pthread_mutex_s
|
||||||
{
|
{
|
||||||
@@ -293,8 +307,10 @@ struct pthread_mutex_s
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_MUTEX_T_DEFINED
|
||||||
typedef struct pthread_mutex_s pthread_mutex_t;
|
typedef struct pthread_mutex_s pthread_mutex_t;
|
||||||
#define __PTHREAD_MUTEX_T_DEFINED 1
|
#define __PTHREAD_MUTEX_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
|
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
|
||||||
# ifdef CONFIG_PTHREAD_MUTEX_DEFAULT_UNSAFE
|
# ifdef CONFIG_PTHREAD_MUTEX_DEFAULT_UNSAFE
|
||||||
@@ -323,8 +339,10 @@ struct pthread_barrierattr_s
|
|||||||
int pshared;
|
int pshared;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_BARRIERATTR_T_DEFINED
|
||||||
typedef struct pthread_barrierattr_s pthread_barrierattr_t;
|
typedef struct pthread_barrierattr_s pthread_barrierattr_t;
|
||||||
#define __PTHREAD_BARRIERATTR_T_DEFINED 1
|
#define __PTHREAD_BARRIERATTR_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
struct pthread_barrier_s
|
struct pthread_barrier_s
|
||||||
{
|
{
|
||||||
@@ -332,11 +350,15 @@ struct pthread_barrier_s
|
|||||||
unsigned int count;
|
unsigned int count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_BARRIER_T_DEFINED
|
||||||
typedef struct pthread_barrier_s pthread_barrier_t;
|
typedef struct pthread_barrier_s pthread_barrier_t;
|
||||||
#define __PTHREAD_BARRIER_T_DEFINED 1
|
#define __PTHREAD_BARRIER_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PTHREAD_ONCE_T_DEFINED
|
||||||
typedef bool pthread_once_t;
|
typedef bool pthread_once_t;
|
||||||
#define __PTHREAD_ONCE_T_DEFINED 1
|
#define __PTHREAD_ONCE_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
struct pthread_rwlock_s
|
struct pthread_rwlock_s
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -275,8 +275,10 @@
|
|||||||
* special meaning in some circumstances (e.g., kill()).
|
* special meaning in some circumstances (e.g., kill()).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __SIGSET_T_DEFINED
|
||||||
typedef uint32_t sigset_t; /* Bit set of 32 signals */
|
typedef uint32_t sigset_t; /* Bit set of 32 signals */
|
||||||
#define __SIGSET_T_DEFINED 1
|
#define __SIGSET_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Possibly volatile-qualified integer type of an object that can be accessed
|
/* Possibly volatile-qualified integer type of an object that can be accessed
|
||||||
* as an atomic entity, even in the presence of asynchronous interrupts.
|
* as an atomic entity, even in the presence of asynchronous interrupts.
|
||||||
@@ -329,8 +331,10 @@ struct siginfo
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __SIGINFO_T_DEFINED
|
||||||
typedef struct siginfo siginfo_t;
|
typedef struct siginfo siginfo_t;
|
||||||
#define __SIGINFO_T_DEFINED 1
|
#define __SIGINFO_T_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Non-standard convenience definition of signal handling function types.
|
/* Non-standard convenience definition of signal handling function types.
|
||||||
* These should be used only internally within the NuttX signal logic.
|
* These should be used only internally within the NuttX signal logic.
|
||||||
|
|||||||
Reference in New Issue
Block a user