game working in debug but not in release

This commit is contained in:
Dennis Eichhorn 2024-11-30 07:31:24 +01:00
parent 87f29a8310
commit c132b425d2
4 changed files with 23 additions and 1 deletions

View File

@ -24,6 +24,16 @@ void atomic_set(volatile int64* value, int64 new_value)
__atomic_store_n(value, new_value, __ATOMIC_SEQ_CST);
}
inline
int32 atomic_set_fetch(volatile int32* value, int32 new_value) {
return __atomic_exchange_n(value, new_value, __ATOMIC_SEQ_CST);
}
inline
int64 atomic_set_fetch(volatile int64* value, int64 new_value) {
return __atomic_exchange_n(value, new_value, __ATOMIC_SEQ_CST);
}
inline
void atomic_get(volatile byte* value, byte data[16])
{

View File

@ -10,7 +10,6 @@
#define TOS_PLATFORM_LINUX_THREADING_SPINLOCK_H
#include "../../../stdlib/Types.h"
#include "Spinlock.h"
typedef volatile int32 spinlock32;

View File

@ -24,6 +24,18 @@ void atomic_set(volatile int64* value, int64 new_value)
InterlockedExchange((long *) value, (long) new_value);
}
inline
int32 atomic_set_fetch(volatile int32* value, int32 new_value)
{
return (int32) InterlockedExchange((long *) value, new_value);
}
inline
int64 atomic_set_fetch(volatile int64* value, int64 new_value)
{
return (int64) InterlockedExchange((long *) value, (long) new_value);
}
inline
void atomic_set(volatile byte* value, const byte new_value[16])
{

View File

@ -11,6 +11,7 @@
#include <windows.h>
#include "../TimeUtils.h"
#include "Spinlock.h"
inline
void spinlock_start(spinlock32* lock, int32 delay = 10) {