Replaced pthread with std:: thread and mutex
This commit is contained in:
@@ -32,9 +32,6 @@ overriden in the c++ code by ifdefs _WIN32 anyway */
|
||||
/* Define to 1 if you have the `dl' library (-ldl). */
|
||||
#define HAVE_LIBDL 1
|
||||
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#define HAVE_LIBPTHREAD 1
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#define HAVE_LIBZ 1
|
||||
|
||||
|
||||
+6
-26
@@ -1,30 +1,10 @@
|
||||
#ifdef HAVE_CXX0X_UNORDERED
|
||||
# define UNORDERED_MAP_INCLUDE <unordered_map>
|
||||
# define UNORDERED_SET_INCLUDE <unordered_set>
|
||||
# define STD_UNORDERED_MAP std::unordered_map
|
||||
# define STD_UNORDERED_SET std::unordered_set
|
||||
#elif defined(HAVE_TR1_UNORDERED)
|
||||
# define UNORDERED_MAP_INCLUDE <tr1/unordered_map>
|
||||
# define UNORDERED_SET_INCLUDE <tr1/unordered_set>
|
||||
# define STD_UNORDERED_MAP std::tr1::unordered_map
|
||||
# define STD_UNORDERED_SET std::tr1::unordered_set
|
||||
#else
|
||||
# define UNORDERED_MAP_INCLUDE <map>
|
||||
# define UNORDERED_SET_INCLUDE <set>
|
||||
# define STD_UNORDERED_MAP std::map
|
||||
# define STD_UNORDERED_SET std::set
|
||||
#endif
|
||||
#define UNORDERED_MAP_INCLUDE <unordered_map>
|
||||
#define UNORDERED_SET_INCLUDE <unordered_set>
|
||||
#define STD_UNORDERED_MAP std::unordered_map
|
||||
#define STD_UNORDERED_SET std::unordered_set
|
||||
#define MEMORY_INCLUDE <memory>
|
||||
#define STD_SHARED_PTR std::shared_ptr
|
||||
|
||||
#ifdef HAVE_SHARED_PTR_STD
|
||||
# define MEMORY_INCLUDE <memory>
|
||||
# define STD_SHARED_PTR std::shared_ptr
|
||||
#elif defined(HAVE_SHARED_PTR_TR1)
|
||||
# define MEMORY_INCLUDE <tr1/memory>
|
||||
# define STD_SHARED_PTR std::tr1::shared_ptr
|
||||
#else
|
||||
# define MEMORY_INCLUDE "refcntr.h"
|
||||
# define STD_SHARED_PTR RefCntr
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "safewindows.h"
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <locale.h>
|
||||
#include <pthread.h>
|
||||
#include <cstdlib>
|
||||
#if !defined(PUTENV_ARG_CONST)
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "log.h"
|
||||
#include "rclconfig.h"
|
||||
#include "rclinit.h"
|
||||
@@ -37,7 +38,7 @@
|
||||
#include "smallut.h"
|
||||
#include "execmd.h"
|
||||
|
||||
static pthread_t mainthread_id;
|
||||
std::thread::id mainthread_id;
|
||||
|
||||
// Signal etc. processing. We want to be able to properly close the
|
||||
// index if we are currently writing to it.
|
||||
@@ -309,10 +310,8 @@ RclConfig *recollinit(RclInitFlags flags,
|
||||
// threads don't try to do it at once).
|
||||
config->getDefCharset();
|
||||
|
||||
mainthread_id = pthread_self();
|
||||
mainthread_id = std::this_thread::get_id();
|
||||
|
||||
// Init unac locking
|
||||
unac_init_mt();
|
||||
// Init smallut and pathut static values
|
||||
pathut_init_mt();
|
||||
smallut_init_mt();
|
||||
@@ -388,6 +387,6 @@ void recoll_threadinit()
|
||||
|
||||
bool recoll_ismainthread()
|
||||
{
|
||||
return pthread_equal(pthread_self(), mainthread_id);
|
||||
return std::this_thread::get_id() == mainthread_id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user