diff options
-rw-r--r-- | CMake/config.h.in | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | apt-pkg/contrib/error.cc | 28 | ||||
-rw-r--r-- | test/interactive-helper/aptwebserver.cc | 1 |
4 files changed, 4 insertions, 34 deletions
diff --git a/CMake/config.h.in b/CMake/config.h.in index 7b068864c..ee822e204 100644 --- a/CMake/config.h.in +++ b/CMake/config.h.in @@ -31,9 +31,6 @@ /* Define if we have machine/endian.h */ #cmakedefine HAVE_MACHINE_ENDIAN_H -/* Define if we have enabled pthread support */ -#cmakedefine HAVE_PTHREAD - /* Check for getresuid() function and similar ones */ #cmakedefine HAVE_GETRESUID #cmakedefine HAVE_GETRESGID diff --git a/CMakeLists.txt b/CMakeLists.txt index 49650bc0c..6d41f728a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ include(CheckFunctionExists) include(CheckStructHasMember) include(GNUInstallDirs) include(TestBigEndian) -find_package(Threads) +find_package(Threads REQUIRED) find_package(LFS REQUIRED) find_package(Iconv REQUIRED) @@ -146,10 +146,6 @@ test_big_endian(WORDS_BIGENDIAN) # FreeBSD add_definitions(-D_WITH_GETLINE=1) -if (CMAKE_USE_PTHREADS_INIT) - set(HAVE_PTHREAD 1) -endif() - CHECK_INCLUDE_FILES(machine/endian.h HAVE_MACHINE_ENDIAN_H) CHECK_INCLUDE_FILES(sys/endian.h HAVE_SYS_ENDIAN_H) CHECK_INCLUDE_FILES(endian.h HAVE_ENDIAN_H) diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index 0233dfd59..e036f9aed 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -32,33 +32,11 @@ /*}}}*/ // Global Error Object /*{{{*/ -/* If the implementation supports posix threads then the accessor function - is compiled to be thread safe otherwise a non-safe version is used. A - Per-Thread error object is maintained in much the same manner as libc - manages errno */ -#if defined(_POSIX_THREADS) && defined(HAVE_PTHREAD) -#include <pthread.h> - -static pthread_key_t ErrorKey; -static void ErrorDestroy(void *Obj) { delete (GlobalError *)Obj; }; -static void KeyAlloc() { pthread_key_create(&ErrorKey, ErrorDestroy); }; - GlobalError *_GetErrorObj() { - static pthread_once_t Once = PTHREAD_ONCE_INIT; - pthread_once(&Once, KeyAlloc); - - void *Res = pthread_getspecific(ErrorKey); - if (Res == 0) - pthread_setspecific(ErrorKey, Res = new GlobalError); - return (GlobalError *)Res; - } -#else - GlobalError *_GetErrorObj() { - static GlobalError *Obj = new GlobalError; - return Obj; - } -#endif + static thread_local GlobalError *Obj = new GlobalError; + return Obj; +} /*}}}*/ // GlobalError::GlobalError - Constructor /*{{{*/ GlobalError::GlobalError() : PendingFlag(false) {} diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index b4b3ef870..11f9b4b4f 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -11,7 +11,6 @@ #include <dirent.h> #include <errno.h> #include <netinet/in.h> -#include <pthread.h> #include <regex.h> #include <signal.h> #include <stddef.h> |