mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 02:38:52 -05:00
Removed legacy threading macros.
This commit is contained in:
parent
1baf233d12
commit
230557ec28
|
@ -72,53 +72,6 @@
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We support two different ways for getting the number of processors in
|
|
||||||
// the system: sysconf (POSIX) and sysctl (BSD?)
|
|
||||||
#if defined( _GLFW_HAS_SYSCONF )
|
|
||||||
|
|
||||||
// Use a single constant for querying number of online processors using
|
|
||||||
// the sysconf function (e.g. SGI defines _SC_NPROC_ONLN instead of
|
|
||||||
// _SC_NPROCESSORS_ONLN)
|
|
||||||
#ifndef _SC_NPROCESSORS_ONLN
|
|
||||||
#ifdef _SC_NPROC_ONLN
|
|
||||||
#define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
|
|
||||||
#else
|
|
||||||
#error POSIX constant _SC_NPROCESSORS_ONLN not defined!
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Macro for querying the number of processors
|
|
||||||
#define _glfw_numprocessors(n) n=(int)sysconf(_SC_NPROCESSORS_ONLN)
|
|
||||||
|
|
||||||
#elif defined( _GLFW_HAS_SYSCTL )
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
|
|
||||||
// Macro for querying the number of processors
|
|
||||||
#define _glfw_numprocessors(n) { \
|
|
||||||
int mib[2], ncpu; \
|
|
||||||
size_t len = 1; \
|
|
||||||
mib[0] = CTL_HW; \
|
|
||||||
mib[1] = HW_NCPU; \
|
|
||||||
n = 1; \
|
|
||||||
if( sysctl( mib, 2, &ncpu, &len, NULL, 0 ) != -1 ) \
|
|
||||||
{ \
|
|
||||||
if( len > 0 ) \
|
|
||||||
{ \
|
|
||||||
n = ncpu; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// If neither sysconf nor sysctl is supported, assume single processor
|
|
||||||
// system
|
|
||||||
#define _glfw_numprocessors(n) n=1
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Pointer length integer
|
// Pointer length integer
|
||||||
// One day, this will most likely move into glfw.h
|
// One day, this will most likely move into glfw.h
|
||||||
typedef intptr_t GLFWintptr;
|
typedef intptr_t GLFWintptr;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user