replace typedef enum to pure enum ThreadAffinityPolicy

fix problem in cmake for pthread_setaffinity_np
This commit is contained in:
bas524 2015-03-17 08:33:05 +03:00
parent 9d4d3e41dd
commit 6b7c87bf5c
2 changed files with 10 additions and 7 deletions

View File

@ -111,11 +111,14 @@ add_definitions( -DPCRE_STATIC)
if(UNIX AND NOT APPLE)
INCLUDE (CheckFunctionExists)
INCLUDE (CheckCXXSourceCompiles)
CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP)
if(HAVE_PTHREAD_SETAFFINITY_NP)
message(STATUS "Platform has PTHREAD_SETAFFINITY_NP")
add_definitions(-DHAVE_PTHREAD_SETAFFINITY_NP)
INCLUDE (CheckLibraryExists)
CHECK_LIBRARY_EXISTS(pthread pthread_setaffinity_np "pthread.h" HAVE_PTHREAD_SETAFFINITY_NP)
#set(CMAKE_EXTRA_INCLUDE_FILES pthread.h)
#CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP)
if(NOT HAVE_PTHREAD_SETAFFINITY_NP)
message(STATUS "Platform has not PTHREAD_SETAFFINITY_NP")
else(HAVE_PTHREAD_SETAFFINITY_NP)
add_definitions(-DHAVE_PTHREAD_SETAFFINITY_NP)
CHECK_CXX_SOURCE_COMPILES("
#include <sched.h>
int main() {
@ -142,7 +145,7 @@ if(UNIX AND NOT APPLE)
endif(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
endif(HAVE_THREE_PARAM_SCHED_SETAFFINITY)
endif(HAVE_PTHREAD_SETAFFINITY_NP)
endif(NOT HAVE_PTHREAD_SETAFFINITY_NP)
endif(UNIX AND NOT APPLE)
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS})

View File

@ -48,12 +48,12 @@ class Foundation_API ThreadPool
/// from the pool.
{
public:
typedef enum _ThreadAffinityPolicy
enum _ThreadAffinityPolicy
{
OS_DEFAULT = 0,
UNIFORM_DISTRIBUTION,
CUSTOM
} ThreadAffinityPolicy;
};
ThreadPool(int minCapacity = 2,
int maxCapacity = 16,