[winpr] add WINPR_ALIGN64 defines

Add defines to aling struct members to 8 bytes
This commit is contained in:
akallabeth 2024-03-12 12:22:34 +01:00 committed by Martin Fleisz
parent 6b5f262660
commit d87d598305
2 changed files with 29 additions and 29 deletions

View File

@ -119,6 +119,16 @@
#define INLINE inline
#endif
#if defined(__GNUC__) || defined(__clang__)
#define WINPR_ALIGN64 __attribute__((aligned(8)))
#else
#ifdef _WIN32
#define WINPR_ALIGN64 __declspec(align(8))
#else
#define WINPR_ALIGN64
#endif
#endif
WINPR_API void winpr_get_version(int* major, int* minor, int* revision);
WINPR_API const char* winpr_get_version_string(void);
WINPR_API const char* winpr_get_build_revision(void);

View File

@ -32,49 +32,39 @@
#include "../synch/event.h"
#include "apc.h"
#ifdef __GNUC__
#define ALIGN64 __attribute__((aligned(8)))
#else
#ifdef _WIN32
#define ALIGN64 __declspec(align(8))
#else
#define ALIGN64
#endif
#endif
typedef void* (*pthread_start_routine)(void*);
typedef struct winpr_APC_item WINPR_APC_ITEM;
typedef struct
{
ALIGN64 pthread_mutex_t mux;
ALIGN64 pthread_cond_t cond;
ALIGN64 BOOL val;
WINPR_ALIGN64 pthread_mutex_t mux;
WINPR_ALIGN64 pthread_cond_t cond;
WINPR_ALIGN64 BOOL val;
} mux_condition_bundle;
struct winpr_thread
{
WINPR_HANDLE common;
ALIGN64 BOOL started;
ALIGN64 WINPR_EVENT_IMPL event;
ALIGN64 BOOL mainProcess;
ALIGN64 BOOL detached;
ALIGN64 BOOL joined;
ALIGN64 BOOL exited;
ALIGN64 DWORD dwExitCode;
ALIGN64 pthread_t thread;
ALIGN64 SIZE_T dwStackSize;
ALIGN64 LPVOID lpParameter;
ALIGN64 pthread_mutex_t mutex;
WINPR_ALIGN64 BOOL started;
WINPR_ALIGN64 WINPR_EVENT_IMPL event;
WINPR_ALIGN64 BOOL mainProcess;
WINPR_ALIGN64 BOOL detached;
WINPR_ALIGN64 BOOL joined;
WINPR_ALIGN64 BOOL exited;
WINPR_ALIGN64 DWORD dwExitCode;
WINPR_ALIGN64 pthread_t thread;
WINPR_ALIGN64 SIZE_T dwStackSize;
WINPR_ALIGN64 LPVOID lpParameter;
WINPR_ALIGN64 pthread_mutex_t mutex;
mux_condition_bundle isRunning;
mux_condition_bundle isCreated;
ALIGN64 LPTHREAD_START_ROUTINE lpStartAddress;
ALIGN64 LPSECURITY_ATTRIBUTES lpThreadAttributes;
ALIGN64 APC_QUEUE apc;
WINPR_ALIGN64 LPTHREAD_START_ROUTINE lpStartAddress;
WINPR_ALIGN64 LPSECURITY_ATTRIBUTES lpThreadAttributes;
WINPR_ALIGN64 APC_QUEUE apc;
#if defined(WITH_DEBUG_THREADS)
ALIGN64 void* create_stack;
ALIGN64 void* exit_stack;
WINPR_ALIGN64 void* create_stack;
WINPR_ALIGN64 void* exit_stack;
#endif
};