Skip to content

Commit

Permalink
Happy little build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaetemi committed Feb 23, 2023
1 parent 549bc90 commit bc6cbc3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
27 changes: 9 additions & 18 deletions nel/include/nel/misc/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#ifdef NL_CPP14
// Disable this to test native implementation
// #define NL_ATOMIC_CPP14
#define NL_ATOMIC_CPP14
#endif

#if (defined(NL_ATOMIC_CPP14) && defined(NL_CPP20))
Expand All @@ -49,8 +49,9 @@
#endif

#ifdef NL_CPP14
#include <atomic>
#include <thread>
#include <mutex>
#include <atomic>
#endif

namespace NLMISC {
Expand Down Expand Up @@ -137,7 +138,7 @@ class CAtomicFlag
}
#elif defined(NL_ATOMIC_GCC)
private:
volatile bool m_Flag;
volatile int m_Flag;

public:
NL_FORCE_INLINE bool testAndSet()
Expand All @@ -152,7 +153,7 @@ class CAtomicFlag

NL_FORCE_INLINE bool test() const // get current value without changing, acquire
{
return __sync_fetch_and_add(const_cast<volatile bool *>(&m_Flag), 0); // acquire
return __sync_fetch_and_add(const_cast<volatile int *>(&m_Flag), 0); // acquire
}
#elif defined(NL_ATOMIC_CPP20)
private:
Expand Down Expand Up @@ -239,28 +240,25 @@ class CAtomicInt
std::atomic_int m_Value;

public:

NL_FORCE_INLINE int load(TMemoryOrder order = TMemoryOrderAcquire) const
{
static_assert(order <= TMemoryOrderAcquire, "Unsupported memory order");
return m_Value.load((std::memory_order)order);
}

NL_FORCE_INLINE int store(int value, TMemoryOrder order = TMemoryOrderRelease)
{
static_assert(order <= TMemoryOrderRelease, "Unsupported memory order");
m_Value.store(value, (std::memory_order)order);
return value;
}

NL_FORCE_INLINE int fetchAdd(int value, TMemoryOrder order = TMemoryOrderAcqRel)
{
static_assert(order <= TMemoryOrderAcqRel, "Unsupported memory order");
return m_Value.fetch_add(value, (std::memory_order)order);
}

NL_FORCE_INLINE int exchange(int value, TMemoryOrder order = TMemoryOrderAcqRel)
{
static_assert(order <= TMemoryOrderAcqRel, "Unsupported memory order");
return m_Value.exchange(value, (std::memory_order)order);
}

Expand Down Expand Up @@ -303,26 +301,22 @@ class CAtomicInt
public:
NL_FORCE_INLINE int load(TMemoryOrder order = TMemoryOrderAcquire) const
{
static_assert(order <= TMemoryOrderAcquire, "Unsupported memory order");
return __atomic_load_n(&m_Value, (int)order);
}

NL_FORCE_INLINE int store(int value, TMemoryOrder order = TMemoryOrderRelease)
{
static_assert(order <= TMemoryOrderRelease, "Unsupported memory order");
__atomic_store_n(&m_Value, value, (int)order);
return value;
}

NL_FORCE_INLINE int fetchAdd(int value, TMemoryOrder order = TMemoryOrderAcqRel)
{
static_assert(order <= TMemoryOrderAcqRel, "Unsupported memory order");
return __atomic_fetch_add(&m_Value, value, (int)order);
}

NL_FORCE_INLINE int exchange(int valu, TMemoryOrder order = TMemoryOrderAcqRel)
{
static_assert(order <= TMemoryOrderAcqRel, "Unsupported memory order");
return __atomic_exchange_n(&m_Value, value, (int)order);
}
#elif defined(NL_ATOMIC_GCC)
Expand Down Expand Up @@ -520,20 +514,17 @@ class CAtomicEnum
CAtomicInt m_Value;

public:
NL_FORCE_INLINE(int)
T load(TMemoryOrder order = TMemoryOrderAcquire) const
NL_FORCE_INLINE T load(TMemoryOrder order = TMemoryOrderAcquire) const
{
return m_Value.load(order);
}

NL_FORCE_INLINE(int)
T store(T value, TMemoryOrder order = TMemoryOrderRelease)
NL_FORCE_INLINE T store(T value, TMemoryOrder order = TMemoryOrderRelease)
{
return m_Value.store((int)value, order);
}

NL_FORCE_INLINE(int)
T exchange(T value, TMemoryOrder order = TMemoryOrderAcqRel)
NL_FORCE_INLINE T exchange(T value, TMemoryOrder order = TMemoryOrderAcqRel)
{
return m_Value.exchange((int)value, order);
}
Expand Down
2 changes: 1 addition & 1 deletion ryzom/client/src/quic_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void CQuicConnection::connect(const NLNET::CInetHost &addr)
{
}

void CQuicConnection::disconnect()
void CQuicConnection::disconnect(bool blocking)
{
}

Expand Down

0 comments on commit bc6cbc3

Please sign in to comment.