VC2008 / VC2010: Enabled precompiled header through Globals.h; the header included in every module in the project. Compilation optimization.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@188 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -1,37 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <WinSock.h>
|
||||
// #define socklen_t int
|
||||
// #ifdef SendMessage
|
||||
// #undef SendMessage
|
||||
// #endif
|
||||
#else
|
||||
|
||||
// Linux threads http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
|
||||
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#define SOCKET int
|
||||
typedef void *HANDLE;
|
||||
#define CRITICAL_SECTION pthread_mutex_t
|
||||
#define SD_BOTH (2)
|
||||
#define closesocket(x) (shutdown(x, SD_BOTH), close(x))
|
||||
#define SOCKET_ERROR SO_ERROR
|
||||
#define EnterCriticalSection(x) pthread_mutex_lock(x)
|
||||
#define LeaveCriticalSection(x) pthread_mutex_unlock(x)
|
||||
#define InitializeCriticalSection(x) pthread_mutex_init(x, NULL)
|
||||
#define DeleteCriticalSection(x) (x)
|
||||
#define sprintf_s(x, y, ...) sprintf(x, __VA_ARGS__)
|
||||
#ifndef _WIN32
|
||||
// Linux threads http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// TODO: We shouldn't need these! Use the OS support objects instead
|
||||
#define SOCKET int
|
||||
typedef void *HANDLE;
|
||||
#define CRITICAL_SECTION pthread_mutex_t
|
||||
#define SD_BOTH (2)
|
||||
#define closesocket(x) (shutdown(x, SD_BOTH), close(x))
|
||||
#define SOCKET_ERROR SO_ERROR
|
||||
#define EnterCriticalSection(x) pthread_mutex_lock(x)
|
||||
#define LeaveCriticalSection(x) pthread_mutex_unlock(x)
|
||||
#define InitializeCriticalSection(x) pthread_mutex_init(x, NULL)
|
||||
#define DeleteCriticalSection(x) (x)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline bool IsSocketError( int a_ReturnedValue )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
Reference in New Issue
Block a user