26 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1800
29 # define roundf(x) (floorf(x + 0.5f))
30 # define round(x) (floorf(x + 0.5))
38 #if defined(WIN32) && defined(DEBUG)
39 # define WIN32_LEAN_AND_MEAN
43 #if (defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)) || defined(__NetBSD__) || defined(__APPLE__) || defined(__sun)
47 #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
49 # include <pthread_np.h>
52 #if defined(__HAIKU__)
53 # include <kernel/scheduler.h>
58 #if defined(_MSC_VER) && defined(DEBUG)
59 # define WIN32_LEAN_AND_MEAN
65 static void setThreadName(
const char *name)
67 const DWORD MS_VC_EXCEPTION=0x406D1388;
69 typedef struct tagTHREADNAME_INFO
86 RaiseException( MS_VC_EXCEPTION, 0,
sizeof(info)/
sizeof(ULONG_PTR),
89 __except(EXCEPTION_EXECUTE_HANDLER)
95 static void setThreadName(
const char* name)
97 #if defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
98 #if __GLIBC__ > 2 || __GLIBC_MINOR__ > 11 || defined(__sun)
99 pthread_setname_np(pthread_self(), name);
101 #elif defined(__FreeBSD__) || defined(__DragonFly__)
102 pthread_set_name_np(pthread_self(), name);
103 #elif defined(__NetBSD__)
104 pthread_setname_np(pthread_self(),
"%s",
const_cast<char *
>(name));
105 #elif defined(__OpenBSD__)
106 pthread_set_name_np(pthread_self(),
const_cast<char *
>(name));
107 #elif defined(__APPLE__)
108 pthread_setname_np(name);
109 #elif defined(__HAIKU__)
110 rename_thread(find_thread(
nullptr), name);
Visual studio workarounds in one place Note that Visual Studio 2013 does have the maths functions def...
Definition: vs.hpp:57