Skip to content
Snippets Groups Projects
Commit e1e034cc authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Use atomics for protected-ints on other *nixes too (not just FreeBSD)

parent e06cc807
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1353 failed
...@@ -217,7 +217,7 @@ int DLLCALL pthread_mutex_destroy(pthread_mutex_t* mutex) ...@@ -217,7 +217,7 @@ int DLLCALL pthread_mutex_destroy(pthread_mutex_t* mutex)
/* Protected (thread-safe) Integers (e.g. atomic/interlocked variables) */ /* Protected (thread-safe) Integers (e.g. atomic/interlocked variables) */
/************************************************************************/ /************************************************************************/
#ifdef __FreeBSD__ #ifdef __unix__
#define PROTECTED_TYPE_INIT(type) \ #define PROTECTED_TYPE_INIT(type) \
int DLLCALL protected_##type##_init(protected_##type##_t* prot, type##_t value) \ int DLLCALL protected_##type##_init(protected_##type##_t* prot, type##_t value) \
{ \ { \
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include "gen_defs.h" /* HANDLE */ #include "gen_defs.h" /* HANDLE */
#include "wrapdll.h" /* DLLEXPORT and DLLCALL */ #include "wrapdll.h" /* DLLEXPORT and DLLCALL */
#ifdef __FreeBSD__ #ifdef __unix__
#include <stdatomic.h> #include <stdatomic.h>
#endif #endif
...@@ -152,7 +152,7 @@ DLLEXPORT int DLLCALL pthread_once(pthread_once_t *oc, void (*init)(void)); ...@@ -152,7 +152,7 @@ DLLEXPORT int DLLCALL pthread_once(pthread_once_t *oc, void (*init)(void));
/* working and being thread-safe on all platforms that support pthread */ /* working and being thread-safe on all platforms that support pthread */
/* mutexes. */ /* mutexes. */
/************************************************************************/ /************************************************************************/
#ifdef __FreeBSD__ #ifdef __unix__
typedef _Atomic(int32_t) protected_int32_t; typedef _Atomic(int32_t) protected_int32_t;
typedef _Atomic(uint32_t) protected_uint32_t; typedef _Atomic(uint32_t) protected_uint32_t;
typedef _Atomic(int64_t) protected_int64_t; typedef _Atomic(int64_t) protected_int64_t;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment