diff options
Diffstat (limited to 'sysdeps/nptl')
-rw-r--r-- | sysdeps/nptl/internaltypes.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sysdeps/nptl/internaltypes.h b/sysdeps/nptl/internaltypes.h index 2f105459ee..7c0d2402a3 100644 --- a/sysdeps/nptl/internaltypes.h +++ b/sysdeps/nptl/internaltypes.h @@ -20,6 +20,8 @@ #define _INTERNALTYPES_H 1 #include <stdint.h> +#include <atomic.h> +#include <endian.h> struct pthread_attr @@ -141,9 +143,29 @@ struct pthread_key_struct /* Semaphore variable structure. */ struct new_sem { +#if __HAVE_64B_ATOMICS + /* The data field holds both value (in the least-significant 32 bytes) and + nwaiters. */ +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define SEM_VALUE_OFFSET 0 +# elif __BYTE_ORDER == __BIG_ENDIAN +# define SEM_VALUE_OFFSET 1 +# else +# error Unsupported byte order. +# endif +# define SEM_NWAITERS_SHIFT 32 +# define SEM_VALUE_MASK (~(unsigned int)0) + unsigned long int data; + int private; + int pad; +#else +# define SEM_VALUE_SHIFT 1 +# define SEM_NWAITERS_MASK ((unsigned int)1) unsigned int value; int private; - unsigned long int nwaiters; + int pad; + unsigned int nwaiters; +#endif }; struct old_sem |