#include "../include/Plateform.h" #ifdef Plateform_Windows typedef DWORD ThreadIDType; typedef HANDLE ThreadHandleType; #define AtomicIncrement(i) ::InterlockedIncrement ( (long*)&i ) #define AtomicDecrement(i) ::InterlockedDecrement ( (long*)&i ) #define AtomicExchange(i, val) InterlockedExchange((long*)&i, val ) #else #ifdef Plateform_Linux typedef pthread_t ThreadIDType; typedef pthread_t ThreadHandleType; #define AtomicIncrement(i) __sync_add_and_fetch(&i, 1) #define AtomicDecrement(i) __sync_add_and_fetch(&i, -1) #define AtomicExchange(i, val) __sync_lock_test_and_set (&i, val) #endif #endif #ifdef Plateform_Linux #ifndef SOCKET typedef int SOCKET; #endif #ifndef SOCKADDR_IN typedef sockaddr_in SOCKADDR_IN; #endif #ifndef IN_ADDR typedef in_addr IN_ADDR; #endif #ifndef UINT typedef unsigned int UINT; #endif #define Sleep usleep #endif
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0