diff options
| author | Sonicadvance1 <sonicadvance1@gmail.com> | 2008-10-30 19:48:26 +0000 |
|---|---|---|
| committer | Sonicadvance1 <sonicadvance1@gmail.com> | 2008-10-30 19:48:26 +0000 |
| commit | 0ab16c6af00a51cf6ba64cba2155bbb8c6e51781 (patch) | |
| tree | cba2a0487bd5c43446c9bc9c1253fd43d8f92456 /Source/Core/Common | |
| parent | a5ca940d649a30f899527ba18512ffd87a2ed385 (diff) | |
Added InterlockedExchange to Linux side
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1018 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Src/Thread.cpp | 9 | ||||
| -rw-r--r-- | Source/Core/Common/Src/Thread.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp index 95b5d1ca65..ce95776242 100644 --- a/Source/Core/Common/Src/Thread.cpp +++ b/Source/Core/Common/Src/Thread.cpp @@ -358,6 +358,15 @@ int InterlockedExchangeAdd(int *Addend, int Increment) return result + Increment;
#endif
}
+int InterlockedExchange(int *Addend, int Increment)
+{
+#if defined(__GNUC__) && defined (__GNUC_MINOR__) && ((4 < __GNUC__) || (4 == __GNUC__ && 1 <= __GNUC_MINOR__))
+ return __sync_lock_test_and_set(Addend, Increment);
+#else
+ // TODO:
+ #warning Support older GCC Versions
+#endif
+}
#endif
diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h index e71306baf1..069397a838 100644 --- a/Source/Core/Common/Src/Thread.h +++ b/Source/Core/Common/Src/Thread.h @@ -116,6 +116,7 @@ void SetCurrentThreadName(const char *name); #ifndef _WIN32
int InterlockedExchangeAdd(int *Addend, int Increment);
+int InterlockedExchange(int *Addend, int Increment);
#endif
} // end of namespace Common
|
