include/pthread.h and signal.h: Avoid redefinition of types

This commit is contained in:
Xiang Xiao 2019-01-27 11:34:39 -06:00 committed by Gregory Nutt
parent daf26128d7
commit 43d47a66c5
2 changed files with 26 additions and 0 deletions

View File

@ -203,11 +203,15 @@ extern "C"
/* pthread-specific types */
#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
typedef pthread_addr_t (*pthread_startroutine_t)(pthread_addr_t);
typedef pthread_startroutine_t pthread_func_t;
@ -236,22 +240,30 @@ struct pthread_attr_s
#endif
};
#ifndef __PTHREAD_ATTR_T_DEFINED
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 int pthread_condattr_t;
#define __PTHREAD_CONDATTR_T_DEFINED 1
#endif
struct pthread_cond_s
{
sem_t sem;
};
#ifndef __PTHREAD_COND_T_DEFINED
typedef struct pthread_cond_s pthread_cond_t;
#define __PTHREAD_COND_T_DEFINED 1
#endif
#define PTHREAD_COND_INITIALIZER {SEM_INITIALIZER(0)}
@ -269,8 +281,10 @@ struct pthread_mutexattr_s
#endif
};
#ifndef __PTHREAD_MUTEXATTR_T_DEFINED
typedef struct pthread_mutexattr_s pthread_mutexattr_t;
#define __PTHREAD_MUTEXATTR_T_DEFINED 1
#endif
struct pthread_mutex_s
{
@ -293,8 +307,10 @@ struct pthread_mutex_s
#endif
};
#ifndef __PTHREAD_MUTEX_T_DEFINED
typedef struct pthread_mutex_s pthread_mutex_t;
#define __PTHREAD_MUTEX_T_DEFINED 1
#endif
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
# ifdef CONFIG_PTHREAD_MUTEX_DEFAULT_UNSAFE
@ -323,8 +339,10 @@ struct pthread_barrierattr_s
int pshared;
};
#ifndef __PTHREAD_BARRIERATTR_T_DEFINED
typedef struct pthread_barrierattr_s pthread_barrierattr_t;
#define __PTHREAD_BARRIERATTR_T_DEFINED 1
#endif
struct pthread_barrier_s
{
@ -332,11 +350,15 @@ struct pthread_barrier_s
unsigned int count;
};
#ifndef __PTHREAD_BARRIER_T_DEFINED
typedef struct pthread_barrier_s pthread_barrier_t;
#define __PTHREAD_BARRIER_T_DEFINED 1
#endif
#ifndef __PTHREAD_ONCE_T_DEFINED
typedef bool pthread_once_t;
#define __PTHREAD_ONCE_T_DEFINED 1
#endif
struct pthread_rwlock_s
{

View File

@ -275,8 +275,10 @@
* special meaning in some circumstances (e.g., kill()).
*/
#ifndef __SIGSET_T_DEFINED
typedef uint32_t sigset_t; /* Bit set of 32 signals */
#define __SIGSET_T_DEFINED 1
#endif
/* Possibly volatile-qualified integer type of an object that can be accessed
* as an atomic entity, even in the presence of asynchronous interrupts.
@ -329,8 +331,10 @@ struct siginfo
#endif
};
#ifndef __SIGINFO_T_DEFINED
typedef struct siginfo siginfo_t;
#define __SIGINFO_T_DEFINED 1
#endif
/* Non-standard convenience definition of signal handling function types.
* These should be used only internally within the NuttX signal logic.