aboutsummaryrefslogtreecommitdiff
path: root/store/works/life/operating-system-experiment/Interlocked.cpp
blob: 7fc8c6b2e206ba96646c6f86f6c175dd7bf81c42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "Interlocked.hpp"

#ifdef CRU_WINDOWS
#include <Windows.h>
#else
#endif

namespace cru {
void CruInterlockedAdd(volatile long long *v, long long a) {
#ifdef CRU_WINDOWS
  InterlockedAdd64(v, a);
#else
  __sync_fetch_and_add(v, a);
#endif
}
} // namespace cru