Update flecs stdcpp threading api

isolation_bkp/dynres
Dominik Madarász 2021-10-27 10:32:46 +02:00
parent 7d5c519e2f
commit ff9f483da1
1 changed files with 8 additions and 4 deletions

View File

@ -5,6 +5,10 @@
#include "flecs/flecs.h" #include "flecs/flecs.h"
#ifdef _WIN32
#include <Windows.h>
#endif
static static
ecs_os_thread_t stdcpp_thread_new( ecs_os_thread_t stdcpp_thread_new(
ecs_os_thread_callback_t callback, ecs_os_thread_callback_t callback,
@ -32,8 +36,8 @@ int32_t stdcpp_ainc(int32_t *count) {
value = __sync_add_and_fetch (count, 1); value = __sync_add_and_fetch (count, 1);
return value; return value;
#else #else
/* Unsupported */ (void)value;
abort(); return InterlockedIncrement(reinterpret_cast<long*>(count));
#endif #endif
} }
@ -44,8 +48,8 @@ int32_t stdcpp_adec(int32_t *count) {
value = __sync_sub_and_fetch (count, 1); value = __sync_sub_and_fetch (count, 1);
return value; return value;
#else #else
/* Unsupported */ (void)value;
abort(); return InterlockedDecrement(reinterpret_cast<long*>(count));
#endif #endif
} }